格式文本框如何突出文本块文本框、文本、突出、格式

由网友(空城旧忆故人离)分享简介:我需要在RTB文本的某一部分要在改变的字体样式/彩色的感不突出,但在制造一个块选择与特定颜色的感觉。这类似于Visual Studio中如何突出期间调试模式的线。I need a certain portion of my text in RTB to be highlighted not in the sense...

我需要在RTB文本的某一部分要在改变的字体样式/彩色的感不突出,但在制造一个块选择与特定颜色的感觉。这类似于Visual Studio中如何突出期间调试模式的线。

I need a certain portion of my text in RTB to be highlighted not in the sense of changing the font style/color, but in the sense of making a block selection with a particular color. This is similar to how Visual Studio highlights a line during debug mode.

我如何可以完成使用RTB这个功能或者更确切地说,是它甚至可能吗?如果这是不可能的,我想听到执行上述任务的另一种方式。

How can I accomplish this feature using RTB or rather, is it even possible? If it isn't possible, I'd like to hear another way of performing the above task.

推荐答案

我认为你正在寻找 ScintillaNET 。

在另一方面,如果你想自己的RTB要做到这一点,那么你可以先找到行号使用的 TextBoxBase.Lines 财产。然后...

On the other hand if you want to do this by yourself in RTB then you can do it by first finding the lineNumber using TextBoxBase.Lines property. Then ...

//Select the line from it's number
startIndex = richTextBox.GetFirstCharIndexFromLine(lineNumber);
richTextBox.Select(startIndex, length);

//Set the selected text fore and background color
richTextBox.SelectionColor = System.Drawing.Color.White;
richTextBox.SelectionBackColor= System.Drawing.Color.Blue;
阅读全文

相关推荐

最新文章