Winform中类的string属性在VS属性栏的值输入框

.Net技术 码拜 9年前 (2015-03-29) 1816次浏览 0个评论

下面代码是创建一个TextBoxEx,并增加了一个string型的属性Msg
public class TextBoxEx : TextBox
    {
        private string msg = “”;
        public string Msg
        {
            get { return this.msg; }
            set { this.msg = value; }
        }
    
    }
在使用TextBoxEx的时候,发现VS属性栏里,Msg和Text的值输入框不一样,这两个属性都属于string型啊。
Winform中类的string属性在VS属性栏的值输入框
因为Text的值输入框特殊,输入的内容可以换行,但Msg的输入框不能换行。
有没有办法可以让Msg的值输入框和Text的一样呢!

Winform中类的string属性在VS属性栏的值输入框
40分
那是多行文本,在属性上面加上
[System.ComponentModel.Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
还可以在加上一个描述
[Description(“消息正文”)]
会在属性栏的最下方显示

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Winform中类的string属性在VS属性栏的值输入框
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!