我找不到那个功能.基本上我有一个多行文本框,当我执行搜索时,我突出显示结果.但是如果结果不在视图中,我将不得不手动向下滚动,直到找到突出显示的结果,这超出了"查找"功能的目的.
我不想使用RichTextBox,因为我遇到了一些性能问题.
您可以GetLineIndexFromCharacterIndex结合使用ScrollToLine:
var selectionStart = x;
var selectionLength = y;
textBox.Select(selectionStart, selectionLength);
textBox.ScrollToLine(textBox.GetLineIndexFromCharacterIndex(textBox.SelectionStart));
Run Code Online (Sandbox Code Playgroud)