自定义控件的常用属性

一、BrowsableAttribute

  指定一个属性或者事件是否在“属性”窗口PropertyGrid显示,默认显示

二、DisplayNameAttribute

  指定一个属性或者事件在"属性"窗口PropertyGrid的显示名称

三、CategoryAttribute

  指定一个属性或者事件在“属性”窗口PropertyGrid的排序顺序模式下的所属分类

四、DescriptionAttribute

  指定一个属性或者事件在”属性“窗口PropertyGrid的描述

 1     public partial class MyUserControl : UserControl
 2     {
 3         public MyUserControl()
 4         {
 5             InitializeComponent();
 6         }
 7 
 8         private string _id1 = string.Empty;
 9 
10         [Browsable(true)]
11         [DisplayName("编号")]
12         [Category("自定义")]
13         [Description("控件唯一编号")]
14         public string ID1
15         {
16             set
17             {
18                 _id1 = value;
19             }
20             get
21             {
22                 return _id1;
23             }
24         }
25     }
View Code

 业务描述:在自定义控件的时候,属性或者事件在PropertyGrid控件中的描述

推荐博客:mapserver

原文地址:https://www.cnblogs.com/hedongsong/p/4565009.html