How do I get notified of a selection change in a text box in .NET 2.0? I was unable to find a SelectionChanged event or an OnSelectionChanged method. What is the best workaround for this (without having to PInvoke, of course)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You could use a RichTextBox and set Multiline to false. It has a OnSelectionChanged.
回答2:
Well, I guess this may help! You will need to use RichTextBox still.
回答3:
You can use TextBox also.
Write a funktion GetMyPosition() and put in the events
- TextChanged()
- MouseClick()
- KeyUp() (In KeyDown() the position isn't changed)
When you want to notify the highliting of a text, you also have to use - MouseHover()