就是,我们单击某个控件,看属性的时候,在下面都会有提示,如控件的"text",在下面就显示控件中包含的文本.
那我们自己写一个自定义控件的时候.
如有一个属性public string ButtonText
{
   get{return buttonText;}
   set{buttonText=value;}
}
那要怎么写,才能在属性框中看到这个属性的"信息"呢?
就是我想当选择这个自定义控件的"ButtonText"的时候,在下面显示"设置按钮的文本值"呢?

解决方案 »

  1.   

    [Browsable(true)] 
    override public Text 

        ... 
    }
      

  2.   

    那出来[Browsable(true)]外,其他的设置呢?
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;
    namespace DeviceApplication1

        class Class1:Control
        {
            private string _ruleName;
            ///<summary>
            ///自定义属性RuleName:获取或设置返回的文本
            ///</summary>
            [Description("获取或设置返回的文本"),DefaultValue(""),Browsable(true)]        
            public string RuleName
            {get{return _ruleName;}
                set
                {_ruleName=value;
                }
            }
            
        }
    }我这样写在一个类里面,却说找不到命名空间,是怎么回事呢?
    我的是VS2005
      

  4.   

    添加   using System.ComponentModel;
      

  5.   

    添加  using System.ComponentModel;

    继承自control类
    都是老问题.