[Browsable(true), Category("Local"), Description("本地IP地址")]

Browsable(true):指定一个事件或者在属性是否显示在属性的窗口中。

Category("Local"):Category 属性 (Property) 在首次被访问时调用该方法以查阅指定类别的本地化名称(好像没啥用)

Description("本地IP地址"):属性窗口中选项的描述信息。

用法:

 

组件类属性窗口显示设置组件类属性窗口显示设置Code
 [Browsable(true), Category("Local"), Description("本地IP地址3")]   //在“属性”窗口中显示localHost属性
        public string LocalHost
        {
            
get { return localHost; }
            
set { localHost = value; }
        }

        
private int localPort = 11000;
        [Browsable(
true), Category("Local"), Description("本地端口号2")] //在“属性”窗口中显示localPort属性
        public int LocalPort
        {
            
get { return localPort; }
            
set { localPort = value; }
        }

        
private bool active = false;
        [Browsable(
true), Category("Local"), Description("**监听")]   //在“属性”窗口中显示active属性
        public bool Active
        {
            
get { return active; }  
            
set //该属性读取值
            { 
                active 
= value;
                
if (active) //当值为True时
                {
                    OpenSocket();   
//打开监听
                }
                
else
                {
                    CloseSocket();  
//关闭监听
                }
            }
        }

效果如下:

组件类属性窗口显示设置

转载于:https://www.cnblogs.com/jinbinhan/archive/2009/03/28/1423809.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-07-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案