【发布时间】:2011-04-24 08:55:50
【问题描述】:
问题来了: 我想让我的程序的用户能够在 webBrowser 控件中搜索给定的关键字(标准 Ctrl+F)。我在文档中找到关键字并使用 span 和 replace() 函数突出显示所有实例没有问题。我我无法获得我想要工作的“查找下一个”功能。当用户单击查找下一个时,我希望文档滚动到下一个实例。如果我能得到一个边界框,我可以使用导航功能。我使用以下代码在富文本框中具有相同的功能
//Select the found text
this.richTextBox.Select(matches[currentMatch], text.Length);
//Scroll to the found text
this.richTextBox.ScrollToCaret();
//Focus so the highlighting shows up
this.richTextBox.Focus();
谁能提供一种方法来让它在 webBrowser 中工作?
【问题讨论】:
标签: c# select browser highlighting