Delphi:查找对话框和字符串网格
有没有办法使用查找对话框在字符串网格
中进行文本搜索?我需要找到一个文本并突出显示它的背景,就像通常找到文本时一样。
谢谢!
Is there a way to do a text search in a string grid
using a find dialog? I need to find a text and highlight it's background as usually when a text is found.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样:
可以轻松扩展此代码以支持向后搜索(“向上”),并且您可能还想实现“匹配整个单词”功能。
也许您只想选择匹配的文本,而不是整个单元格?然后再做
。但这会窃取查找对话框的焦点,因此用户将无法按 Return 键来选择下一个匹配项,这可能会很烦人。
Like this:
This code can easily be extended to support searching backwards ('up'), and you might also want to implement the 'match whole word' feature.
Perhaps you want to select only the matched text, and not the entire cell? Then do
instead. But this will steal the focus from the find dialog, and so the user will not be able to press Return to select the next match, which might be annoying.