all groups > dotnet windows forms > april 2005 >
You're in the

dotnet windows forms

group:

Mouse over text in richtextbox



Mouse over text in richtextbox Lance Johnson
4/7/2005 9:56:52 AM
dotnet windows forms: I can't seem to find out if the mouse cursor is over text in a richtextbox.
I can use GetCharIndexFromPosition but all that does is tell me the closest
character. But if the cursor is outside the range of current text, there's
no way to calculate that. I'm sure there should be something to tell me how
to do this, but I can't seem to find it.

Lance Johnson

Re: Mouse over text in richtextbox Stoitcho Goutsev (100) [C# MVP]
4/7/2005 9:50:56 PM
This has always been a problem I don't think there is a good solution.


--
Stoitcho Goutsev (100) [C# MVP]

[quoted text, click to view]

Re: Mouse over text in richtextbox Lance Johnson
4/8/2005 10:47:47 AM
Well crap. Basically what I did was calculate where the character after the
end of text would appear and if the mouse is on that x position or after,
then it's not over the selected text. This works great for single line
stuff, but obviously can have issues on multi-line stuff if that next
character wraps to the next line. I'm sure I could come up with some kind
of logic to determine that, but I haven't yet because so far we've just been
worried about single-line richtextboxes.

Lance Johnson


[quoted text, click to view]

AddThis Social Bookmark Button