Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在RichTextBox中高亮显示整行_C#_Winforms - Fatal编程技术网

C# 在RichTextBox中高亮显示整行

C# 在RichTextBox中高亮显示整行,c#,winforms,C#,Winforms,我试图突出显示RichTextBox中的一整行。现在我有这个方法 if (Current != null) { selectStart = this.textBox.Text.Length; foreach (string s in Current.Details) { this.textBox.AppendText(s + Environment.NewLine); } selectEnd = this.textBox.Text.Leng

我试图突出显示RichTextBox中的一整行。现在我有这个方法

if (Current != null)
{
    selectStart = this.textBox.Text.Length;
    foreach (string s in Current.Details)
    {
        this.textBox.AppendText(s + Environment.NewLine);
    }
    selectEnd = this.textBox.Text.Length;
    this.textBox.Select(selectStart, selectEnd - selectStart);
    this.textBox.SelectionBackColor = Color.FromArgb(51, 255, 51);
}
但这只会突出显示文本,如下所示:


我希望代码突出显示整个行的长度。有什么方法可以做到这一点吗?

我认为你不能做你想做的事情,因为RichTextBox不支持box模型(就像浏览器使用
块一样)。它只会装饰文本本身。

我认为你不能做你想做的事情,因为RichTextBox不支持box模型(就像浏览器使用
块一样)。它只会装饰文本本身。

也许你可以使用一个列表框来覆盖绘制事件?不太可能。我需要它是一个RichTextBox。也许你可以使用一个listbox来覆盖绘画事件?不太可能。我需要一个RichTextBox。