小编ath*_*gap的帖子

C#查找功能问题(无法突出显示)

我想问为什么我的代码不起作用?

目前,我能够找到用户输入的单词,但它无法突出显示richTextBoxConversation中的单词.

我应该怎么做呢?

以下是我的代码:

    private void buttonTextFilter_Click(object sender, EventArgs e)
    {
        string s1 = richTextBoxConversation.Text.ToLower();
        string s2 = textBoxTextFilter.Text.ToLower();

        if (s1.Contains(s2))
        {
            MessageBox.Show("Word found!");
            richTextBoxConversation.Find(s2);
        }
        else
        {
            MessageBox.Show("Word not found!");
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# richtextbox find winforms

1
推荐指数
1
解决办法
825
查看次数

C#滚动richtextbox

有没有一种方法可以使用代码自动将richtextbox滚动到顶部?谢谢!

c# methods text scroll richtextbox

1
推荐指数
1
解决办法
2913
查看次数

标签 统计

c# ×2

richtextbox ×2

find ×1

methods ×1

scroll ×1

text ×1

winforms ×1