111,092
社区成员




[Localizable(true), SRDescription("TextBoxLinesDescr"), Editor("System.Windows.Forms.Design.StringArrayEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), MergableProperty(false), SRCategory("CatAppearance")]
public string[] Lines
{
get
{
int num2;
string text = this.Text;
ArrayList list = new ArrayList();
for (int i = 0; i < text.Length; i = num2)
{
num2 = i;
while (num2 < text.Length)
{
char ch = text[num2];
if ((ch == '\r') || (ch == '\n'))
{
break;
}
num2++;
}
string str2 = text.Substring(i, num2 - i);
list.Add(str2);
if ((num2 < text.Length) && (text[num2] == '\r'))
{
num2++;
}
if ((num2 < text.Length) && (text[num2] == '\n'))
{
num2++;
}
}
if ((text.Length > 0) && ((text[text.Length - 1] == '\r') || (text[text.Length - 1] == '\n')))
{
list.Add("");
}
return (string[]) list.ToArray(typeof(string));
}
set
{
if ((value != null) && (value.Length > 0))
{
StringBuilder builder = new StringBuilder(value[0]);
for (int i = 1; i < value.Length; i++)
{
builder.Append("\r\n");
builder.Append(value[i]);
}
this.Text = builder.ToString();
}
else
{
this.Text = "";
}
}
}
//首先,应设textbox可多行显示Multiline = true;
private void button1_Click(object sender, EventArgs e)
{
this.textBox1.Text = "1111\r\n2222\r\n";
}