当前位置: 代码迷 >> .NET组件控件 >> 如何获取属性窗口中的集合项-
  详细解决方案

如何获取属性窗口中的集合项-

热度:1637   发布时间:2013-02-25 00:00:00.0
怎么获取属性窗口中的集合项--
[ToolboxItem(false)]
  [ParseChildren(true)]
  [Editor(typeof(SelectCommandCollectionEditor), typeof(UITypeEditor))]
  public class SelectCommandCollection:Collection<SearchSelect>
  {
  public SelectCommandCollection()
  :base()
  {}
  public new int Count{get{return base.Count;}}
  public bool IsReadOnly{get{return false;}}
  public new void Add(SearchSelect se){base.Add(se);}
  public new void Clear(){base.Clear();}
  public new bool Contains(SearchSelect se){return base.Contains(se);}
  public new bool Remove(SearchSelect se){return base.Remove(se);}
  public new SearchSelect this[int index]
  {
  get{return base[index];}
  set{base[index]=value;}
  }
  }
  [ToolboxItem(false)]
  [ParseChildren(true)]
  [Editor(typeof(OptionCommandCollectionEditor), typeof(UITypeEditor))]
  public class OptionCommandCollection : Collection<SearchOption>
  {
  public OptionCommandCollection() : base() { }
  public new int Count { get { return base.Count; } }
  public bool IsReadOnly { get { return false; } }
  public new void Add(SearchOption op) { base.Add(op); }
  public new void Clear() { base.Clear(); }
  public new bool Contains(SearchOption op) { return base.Contains(op); }
  public new bool Remove(SearchOption op) { return base.Remove(op); }
  public new SearchOption this[int index]
  {
  get { return base[index]; }
  set { base[index] = value; }
  }
  }
  public class SelectCommandCollectionEditor : CollectionEditor
  {
  public SelectCommandCollectionEditor(Type type) : base(type) { }
  protected override bool CanSelectMultipleInstances() { return true; }
  protected override Type[] CreateNewItemTypes()
  {
  return new Type[] { typeof(SearchSelect)};
  }
  protected override object CreateInstance(Type itemType)
  {
  if (itemType == typeof(SearchSelect)) { return new SearchSelect(); }
  return null;
  }

  }
  public class OptionCommandCollectionEditor : CollectionEditor
  {
  public OptionCommandCollectionEditor(Type type) : base(type) { }
  protected override bool CanSelectMultipleInstances() { return true; }
  protected override Type[] CreateNewItemTypes()
  {
  return new Type[] { typeof(SearchOption) };
  }
  protected override object CreateInstance(Type itemType)
  {
  if (itemType == typeof(SearchOption)) { return new SearchOption(); }
  return null;
  }

  }
  ///////////////////////////////////////////////
  public class ScriptItem
  {
  private string _Text;
  [DefaultValue("")]
  [Editor("System.ComponentModel.Design.MultilineStringEditor,System.Design", typeof(UITypeEditor))]
  [PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty)]
  [NotifyParentProperty(true)]
  /// <summary> 
  /// JavaScript脚本块 
  /// </summary>     
  public string Text
  {
  get
  {
  相关解决方案