Mouse Position

Silent77

Member
Joined
Oct 17, 2006
Messages
9
Programming Experience
Beginner
I'm trying to have a label appear when I mouse over a button (I have this working) but I want the location to be 5 pixels down and 5 to the right from the current position of the mouse. I was messing with Cursor.Position but that added the x and y to were the mouse was.
My code...
VB.NET:
[SIZE=2]
Label1.Location = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Drawing.Point(Windows.Forms.Cursor.Position)
[/SIZE]

Any ideas? Thanks.
 
Translate those screen points relative to form client points with the controls PointToClient method.
And Cursor.Position is already a Point, no need to initialize a new Point from this coordinate.
VB.NET:
Label1.Location = Me.PointToClient(Windows.Forms.Cursor.Position)
But why don't you use the ToolTip component instead?
 
Back
Top