ScintillaNet - 计算出用户点击了哪一行
我正在使用 ScintillaNet 文本框控件来显示一些搜索结果,我希望能够检测到当用户双击/右键单击结果中的一行时,以便我可以找出他们正在单击的点击。
有人对这样做的最佳方法有任何想法吗?我可以想到几种方法,但对我来说它们似乎都有点“hacky”。
I'm using the ScintillaNet text box control to display some search results and I want to be able to detect when the user double clicks / right clicks on a line in the results so that I can work out which hit they are clicking on.
Does anyone have any ideas on the best way of doing this? I can think of a few ways but they all seem a bit "hacky" to me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要从光标位置获取行号,您可以使用类似的方法
to get the line number from cursor position, you could use something like this
使用新版本的 ScintillaNET 您可以使用更好的函数来获取当前行号:
我能够将事件处理程序附加到
SelectionChanged
事件,然后获取当前行号来执行您所要求的操作。With the new version of ScintillaNET you can use a better function to get the current line number:
I was able to attach an event handler to
SelectionChanged
event and then, get the current line number to do what you've asked.