ScintillaNet - Working out what line a user clicks on
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.
精彩评论