|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Mouse positions
i have a problem with my code. i am trying to get a usercontrol to follow behind the mouse! like a tooltip.
but when i capture the mouse positions, it goes horribly wrong. this is what i have so far: Code:
Dim MousePos As POINTAPI usrToolTip.Visible = True GetCursorPos MousePos usrToolTip.Left = (MousePos.X + Screen.TwipsPerPixelX) usrToolTip.Top = (MousePos.Y + Screen.TwipsPerPixelY) what's wrong with my code? thanks Mark |
|
#2
|
|||
|
|||
|
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Sub MousePos(ByRef FRM As Form, ByRef x, ByRef y) Dim pt As POINTAPI ' Get the current mouse position. GetCursorPos pt ScreenToClient FRM.hwnd, pt ' Convert to twips. x = FRM.ScaleX(pt.x, vbPixels, vbTwips) y = FRM.ScaleY(pt.y, vbPixels, vbTwips) End Sub |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Mouse positions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|