MenuItem Mouse Pointer Coordintes

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi

I am trying to get the exact mouse coordinates as it moves over a
single menuitem on a context menu. As the menu item is not a control i
cannot find any way od doing this.

Any ideas?

Thanks

Tom
 
Hi Tom
The following displays a context menu over a datagrid1.

point = Me.DataGrid1.PointToClient(Cursor.Position)
Me.ContextMenu1.Show(Me.DataGrid1, point)

Kind Regards
Jorge
 
Try this:

Private Structure POINTAPI
Public x As Integer
Public y As Integer
End Structure


Dim pt As POINTAPI

Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As
POINTAPI) As Integer



Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
GetCursorPos(pt)
Debug.WriteLine(pt.x)
Debug.WriteLine(pt.y)
End Sub
 
Thanks,

I have added this code to my inherited MenuItem component, and enabled
the timer. However the timer click event is not getting fired. Have
you any ideas on where i have screwed up?

Cheers

Tom
 
Back
Top