在富文本框中创建换行符 [英] Creating a newline in rich text box

查看:229
本文介绍了在富文本框中创建换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为RichTextBox创建新行的帮助,而使用CheckBox时我无法使它生效。



它一直重叠而不是创建新行。 / p>

使用 rtbdisplay.text =(display + envrionment.newline)方法进行尝试;
示例我的代码:

  if(rbtnSmall.Checked == true)
{
rtbDisplay.Text = displaytext .PadRight(20)+ size .PadRight(23)+
qty.ToString()。PadRight(20)+ StrongDummy;
}


解决方案

使用 RichTextBox.Text 属性或 RichtTextBox.AppendText 方法向字符串添加换行符。

  myRichTextBox.Text + = Environment.NewLine +我的新行。; 

//或

myRichTextBox.AppendText(Environment.NewLine + My new line。);


I need help on creating a new line for my RichTextBox which I cant make work when using CheckBox.

It keeps overlapping instead of creating a newline of words.

Tried using the method of rtbdisplay.text = (display+envrionment.newline); example from my code:

if (rbtnSmall.Checked == true)
{
    rtbDisplay.Text = "displaytext".PadRight(20) + "size".PadRight(23) +
                      qty.ToString().PadRight(20) + StrongDummy;
}

解决方案

Use the RichTextBox.Text property or the RichtTextBox.AppendText method to append a string with a newline.

myRichTextBox.Text += Environment.NewLine + "My new line.";

// Or

myRichTextBox.AppendText( Environment.NewLine + "My new line." );

这篇关于在富文本框中创建换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆