Question

I'm working with a RichTextBox, and would like to do one thing in the SelectionChanged event if the mouse is down, and another if it's not (e.g. if the keyboard is used to select something). However, the SelectionChanged event is apparently called before MouseDown, so it seems there's no way for me to know if the mouse is down while processing the SelectionChanged. Has anyone else run into this problem? Does anyone have a solution that worked for them?

I'm doing some highlighting code, and I need to have the mouse intercepted before SelectionChanged is called.

Was it helpful?

Solution

You could save the selection in a variable and work with it in the MouseDown handler. It would give you pretty much the same behaviour.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top