Control.MouseMove

  • Thread starter Thread starter Elisa
  • Start date Start date
E

Elisa

Hi,

The MSDN library page for a Control.MouseMove event says:

"Occurs when the mouse pointer is moved over the control."

That's not right is it? From looking at several examples, the event also
occurs when initially the mouse was over the control, then a MouseDown
event happened, and then the mouse is moved away from the control. As
long as no MouseUp event occurs, the MouseMove event is still fired
weither the mouse is over the control or not. Right?


Regards,

Elisa
 
Yes, you're right. The mouse move does happen when off the control.

Dan Fergus - eMVP
Forest Software Group
The Defnitive Guide to the .NET Compact Framework
 
Hi Dan,

Hehe, it's actually from reading the Graphics chapter in your book that
I got the idea that the Control.MouseMove event must be more intricate
than what MS says. Quick note about that same chapter, I admit I just
skimmed, but it looks as if you never explain the slightly weird way you
need to specify the dimensions for most GDI routines.

If you want to draw a rectangle 100 pixels long and 50 pixels high, you
need to subtract one from both the width and the height (MS's weird
sense of humour, I suppose).

Listing 7-2 (p. 301), listing 7-3 (p. 301-302), etc. all fall into this
trap. It's not:

g.DrawRectangle(penRect, Me.ClientRectangle)

but:

rc = New Rectangle(Me.ClientRectangle.X, Me.ClientRectangle.Y,
Me.ClientRectangle.Width - 1, Me.ClientRectangle.Height - 1)
g.DrawRectangle(penRect, rc)


Regards,

Elisa
 
Back
Top