如何在文本框中逐行突出显示文本 [英] How to highlight the text in textbox line by line

查看:86
本文介绍了如何在文本框中逐行突出显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#.net

How to highlight the text backcolour in textbox line by line using c#.net

推荐答案

中逐行突出显示文本框中的文本背景色.问题未用UI标记.
Windows Forms中,TextBox 控件不支持为不同的行分配不同的BackColor .
为此,RichTextBox 控件在此处说明
http://msdn.microsoft.com/en-us/library/3tdc88y7.aspx [ ^ ]
可以使用.
但是,要突出显示文本的contiguous 块,可以使用TextBox SelectionStart SelectionLenth 属性,如此处所述
http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.selectionstart.aspx [ ^ ]
The question is not tagged with the UI.
In Windows Forms, the TextBox control does not support assigning different BackColor for different lines.
For this purpose the RichTextBox control explained here
http://msdn.microsoft.com/en-us/library/3tdc88y7.aspx[^]
can be used.
However, to highlight a contiguous block of Text the SelectionStart and SelectionLenth properties of TextBox can be used as explained here
http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.selectionstart.aspx[^]


这篇关于如何在文本框中逐行突出显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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