RichTextBox 每几个字符/行的特定颜色 C#
我有 richTextBox1,内容如下:
我的文本框的第一行是这样的,我希望它是正常的、arial、8 点非粗体字体
第二行,我想要 | 之后的所有内容加粗... |这是粗体
第三行:括号中的所有内容我(想要)成为颜色(红色)
第四行是“这条线将是/倾斜/或斜体
等等,基本上如果我知道如何做我提到的事情上面,我将了解完成我的项目所需的一切。代码示例将非常非常感谢!
I have richTextBox1, and here is the contents:
line one from my textbox is this, and i want this to be normal, arial, 8 point non-bold font
line two, i want everything after the | to be bolded... | this is bold
line three: everything in brackets i (want) to be the color (Red)
line 4 is "this line is going to be /slanted/ or with italics
and so on, basically if I know how to do what I mentioned above, I'll know everything I need to know to complete my project. Code examples would be very very much appreciated! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须设置
SelectionStart
和
SelectionLength
指定要修改的文本,然后设置SelectionColor
和SelectionFont
修改所选文本。http://msdn.microsoft.com/en-我们/library/system.windows.forms.richtextbox_members.aspx
You have to set
SelectionStart
andSelectionLength
to specify the text that you want to modify, and then setSelectionColor
andSelectionFont
to modify the selected text.http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox_members.aspx