473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MenuItem Mouse Pointer Coordintes

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
Nov 20 '05 #1
3 1117
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
-----Original Message-----
Hi

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

Any ideas?

Thanks

Tom
.

Nov 20 '05 #2
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


"Tom" <re***@to.group> wrote in message
news:0a********************************@4ax.com...
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

Nov 20 '05 #3
Tom
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

On Fri, 7 May 2004 09:49:52 -0500, "yEaH rIgHt" <nospam@haha> wrote:
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


"Tom" <re***@to.group> wrote in message
news:0a********************************@4ax.com.. .
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


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
4
by: Videos 4 Sale | last post by:
Would you know how to change the look of a mouse pointer on a web page. On the page I have the mouse pointer is exactly as I have at work.... white. But what I want to do is change the look of it...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
4
by: Norvin Laudon | last post by:
Hi, I have a context menu, which is used for each of 6 labels on my form. That is, right-clicking any of the labels will bring up the same context menu. Once the user clicks the menu, the...
1
by: Tim Haughton | last post by:
Like most fans of eye candy, I've always thought the standard MainMenu control was a bit drab. After looking at third party components, I decided to see if I could brute force it into looking nice....
3
by: Jason | last post by:
I'm trying to implement some pretty basic behavior in c#/.net 1.1 Forms but can't seem to find all the requisite pieces. When a user clicks on the background of the form, I want the app to start...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
2
by: genojoe | last post by:
Creating an enhanced menuItem with additional properties is easy to do. Is there also a way to enhance the menuItem by adding an event to it? I would like to have the MenuItem display a help...
2
by: remya1000 | last post by:
i'm using VB.NET. when a button is clicked the utility will display an hour glass mouse pointer, and it will begin copying the Utility settings from one computer to another computer on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.