1、创建类库
2、在类库中添加用户控件(Window窗体)
3、控件视图
4、后台代码
namespace UILib
{public partial class DeviceInfoV : UserControl{public DeviceInfoV(){InitializeComponent();ParameterInitialize();}#region 初始化private void ParameterInitialize(){GroupDevice = "产品信息1";Product = "产品1";Version = "版本1";Id = "ID1";}#endregion#region 属性private string groupDevice;[Description("产品信息")][Category("自定义属性")]public string GroupDevice{get { return groupDevice; }set { groupDevice = value; gb_device.Text = groupDevice;}}private string product;[Description("产品")][Category("自定义属性")]public string Product{get { return product; }set { product = value; lb_product.Text = product;}}private string version;[Description("版本")][Category("自定义属性")]public string Version{get { return version; }set{version = value;lb_version.Text = version;}}private string id;[Description("ID")][Category("自定义属性")]public string Id{get { return id; }set{id = value;lb_id.Text = id;}}#endregion}
}