111,129
社区成员
发帖
与我相关
我的任务
分享
public partial class SideBarCtrol : UserControl
{
public SideBarCtrol()
{
InitializeComponent();
}
private int typeCount = 1;
[Description("绑定控件子级种类数")]
public int TypeCount
{
get { return typeCount; }
set { typeCount = value; }
}
private Object itemsData = null;
[Description("显示内容数据源")]
public Object ItemsData
{
get { return itemsData; }
set { itemsData = value; }
}
public delegate void IbtnCellClick(object sender, EventArgs e);
[Description("节点点击事件")]
public event IbtnCellClick onCellClick;
private void sideBarItem_onCellClick(object sender, EventArgs e)
{
if (onCellClick != null)
onCellClick(sender, e);
}
3.编译类库项目生成dll文件
4.新的项目中在工具箱中添加选择项,选择dll文件,此时用户控件SideBarCtrol 将会出现在工具箱里。如果将该控件拖入文件,TypeCount、itemsData公共属性将会出现在控件属性栏,onCellClick将会出现在事件栏