|
-
Apr 22nd, 2004, 08:25 PM
#1
Thread Starter
Registered User
cursor position
how do I get the cursor position in relation to a specified control?
-
Apr 22nd, 2004, 11:52 PM
#2
Sleep mode
VB Code:
MousePosition.X and MousePosition.Y
-
Apr 23rd, 2004, 03:23 AM
#3
Hyperactive Member
Almost surely, Pirate gave you what you needed, but if you wanted to know where the blinking cursor is, for example, in a textbox:
Dim goofy As Byte = Me.TextBox1.SelectionStart
Excuse me for my english!
Live long and prosper (Mr. Spock)
-
Apr 23rd, 2004, 07:45 AM
#4
Thread Starter
Registered User
that gives it to me relative to the screen dosn't it pirate? what if I want it in relation to a listview, for example?
-
Apr 24th, 2004, 12:25 AM
#5
Sleep mode
Then use PointToClient function to get coordinates within client area (not in the whole screen)
like this
VB Code:
Dim pnt As Point = Me.ListView1.PointToClient(New Point(MousePosition.X, MousePosition.Y))
MessageBox.Show(pnt.ToString)
-
Apr 24th, 2004, 12:34 AM
#6
Sleep mode
You might need to check the difference between the previous code and this one . Here we used the form's PointToClient function not the control's .
VB Code:
Dim pnt2 As Point = Me.PointToClient(New Point(MousePosition.X, MousePosition.Y))
-
Apr 24th, 2004, 06:58 AM
#7
Thread Starter
Registered User
yeah, thanks pirate.
pointToClient is the way to go.
-marvin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|