开发者

ScintillaNet - Working out what line a user clicks on

开发者 https://www.devze.com 2022-12-24 10:40 出处:网络
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'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.


to get the line number from cursor position, you could use something like this

scintilla1.Lines.FromPosition(scintilla1.CurrentPos).Number


With the new version of ScintillaNET you can use a better function to get the current line number:

scintilla1.Lines.Current.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号