比较复杂。慢慢看。//集合成员类如下格式声明
[ToolboxItem(false)]//设置此类在工具箱中不可见
[DesignTimeVisible(false)]//设置设计时此类不可见
public class BarItem:Component//必需以Component类为基类
{
}//集合类定义如下
public class BarItemCollection:CollectionBase//从集合基类继承
{
//必需要实现的索引
public BarItem this[int index]
{
get{};
set{};
}
//可不实现
public void AddRange(BarItem[] bars)
{
}
}
//控件类定交如下
public class ListBar:UserControl
{
private BarItemCollection baritems;
[Browsable(true)]//设计时可见
[Editor(typeof(CollectionEdit),typeof(UITypeEditor)]//设置设计时编辑集合的编辑器
[DesignerSerializationVisibility(DesignerSerialization.Content)]//设置设计器是序列化它的内容。
public BarItemCollection BarCollections
{
get
{}
set
{}
}
}
以上所有类都是你自实现。可能有部分单词拼错了。可查MSDN
[ToolboxItem(false)]//设置此类在工具箱中不可见
[DesignTimeVisible(false)]//设置设计时此类不可见
public class BarItem:Component//必需以Component类为基类
{
}//集合类定义如下
public class BarItemCollection:CollectionBase//从集合基类继承
{
//必需要实现的索引
public BarItem this[int index]
{
get{};
set{};
}
//可不实现
public void AddRange(BarItem[] bars)
{
}
}
//控件类定交如下
public class ListBar:UserControl
{
private BarItemCollection baritems;
[Browsable(true)]//设计时可见
[Editor(typeof(CollectionEdit),typeof(UITypeEditor)]//设置设计时编辑集合的编辑器
[DesignerSerializationVisibility(DesignerSerialization.Content)]//设置设计器是序列化它的内容。
public BarItemCollection BarCollections
{
get
{}
set
{}
}
}
以上所有类都是你自实现。可能有部分单词拼错了。可查MSDN
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货