Winform下类中的string属性在VS属性栏的值输入框有关问题
Winform下类中的string属性在VS属性栏的值输入框问题
下面代码是创建一个TextBoxEx类,并增加了一个string类型的属性Msg
在使用TextBoxEx类的时候,发现VS属性栏里,Msg和Text的值输入框不一样,这两个属性都属于string类型啊。

因为Text的值输入框特殊,输入的内容可以换行,但Msg的输入框不能换行。
各位高手,大虾们,有没有办法可以让Msg的值输入框和Text的一样呢,急急急!!!
------解决思路----------------------
那是多行文本,在属性上面加上
[System.ComponentModel.Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
还可以在加上一个描述
[Description("消息正文")]
会在属性栏的最正文显示
下面代码是创建一个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类型啊。
因为Text的值输入框特殊,输入的内容可以换行,但Msg的输入框不能换行。
各位高手,大虾们,有没有办法可以让Msg的值输入框和Text的一样呢,急急急!!!
------解决思路----------------------
那是多行文本,在属性上面加上
[System.ComponentModel.Editor(typeof(System.ComponentModel.Design.MultilineStringEditor), typeof(System.Drawing.Design.UITypeEditor))]
还可以在加上一个描述
[Description("消息正文")]
会在属性栏的最正文显示