Results 1 to 4 of 4

Thread: Load From at Cursor Position?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    Load From at Cursor Position?

    Is there a way to have my secondary form, Form2, load at the current cursor position?
    (Left and Top)

  2. #2
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    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.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use the following in a module
    VB Code:
    1. Private Declare Function GetCursorPos _
    2.  Lib "user32" ( _
    3.  lpPoint As POINTAPI) As Long
    4.  
    5. Private Type POINTAPI
    6.     x As Long
    7.     y As Long
    8. End Type
    9.  
    10. Public Sub ShowForm(frm As Form)
    11.     Dim p As POINTAPI
    12.     GetCursorPos p
    13.     frm.Move p.x * Screen.TwipsPerPixelX, p.y * Screen.TwipsPerPixelY
    14.     frm.Show
    15. End Sub
    Now instead of calling Form2.Show call ShowForm Form2

    Best regards

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    Thanks

    Thank you Joacim. This works really great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width