Is there a way to have my secondary form, Form2, load at the current cursor position?
(Left and Top)
Printable View
Is there a way to have my secondary form, Form2, load at the current cursor position?
(Left and Top)
Can't you set form2,s left and right positions to be that of the X and Y values. Do it in the Mouse Down event.
Use the following in a module
Now instead of calling Form2.Show call ShowForm Form2VB Code:
Private Declare Function GetCursorPos _ Lib "user32" ( _ lpPoint As POINTAPI) As Long Private Type POINTAPI x As Long y As Long End Type Public Sub ShowForm(frm As Form) Dim p As POINTAPI GetCursorPos p frm.Move p.x * Screen.TwipsPerPixelX, p.y * Screen.TwipsPerPixelY frm.Show End Sub
Best regards
Thank you Joacim. This works really great.