1、创建类库
2、在类库中添加用户控件(Window窗体)
3、控件视图
4、后台代码文章来源地址https://www.toymoban.com/news/detail-729224.html
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
}
}
文章来源:https://www.toymoban.com/news/detail-729224.html
到了这里,关于C# 自定义控件库之Lable组合控件的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!