Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousehover%28v=vs.110%29.aspx" rel="nofollow noreferrer"><code>Control.MouseHover</code></a> "occurs when the mouse pointer rests on the control."</p> <blockquote> <p>A typical use of MouseHover is to display a tool tip when the mouse pauses on a control within a specified area around the control (the "hover rectangle"). The pause required for this event to be raised is specified in milliseconds by the MouseHoverTime property.</p> </blockquote> <p>So this event is not raised only whenever the mouse is over the control - there is a delay associated. So the position is somewhat irrelevant, as the mouse could have moved somewhat during that delay.</p> <p>Do you really need to be using this event? As <a href="https://stackoverflow.com/questions/20184304/mouse-coordinates-in-mousehover-event/20184445#comment30092006_20184304">Dan-o mentioned</a>, <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousemove.aspx" rel="nofollow noreferrer"><code>MouseMove</code></a> passes a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.mouseeventargs.aspx" rel="nofollow noreferrer"><code>MouseEventArgs</code></a> which does provide the coordinates, as you request. It may be the right option, depending on what exactly you're trying to do.</p> <p>To get the mouse position at <em>any time</em> though, you can use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx" rel="nofollow noreferrer"><code>Cursor.Position</code></a> property. This will give you the <em>screen coordinates</em> of the cursor. From here, you can call the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.pointtoclient.aspx" rel="nofollow noreferrer"><code>Control.PointToClient</code></a> method, to get the coordinates relative to a particular <code>Control</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload