Results 1 to 3 of 3

Thread: Current X and Y Coordinates...

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Virginia
    Posts
    58

    Current X and Y Coordinates...

    I know this is easy, but I forgotten how to find the X, Y coordinates of the mouse on a form. I thought it was CurrentX, CurrentY... but that doesn't seem to be the case. I have a third party control on my form and I need to know where the user has clicked to know which event to fire... but first I need the mouse coordinates in twips... ScaleMode on the form is set to twips.

    Thanks in advanced
    Newty

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    VB Code:
    1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.  
    3.     Me.Label1.Caption = X & ", " & Y
    4.  
    5. End Sub
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    Better is to use the ScreenToClient API.

    The 1st parameter is the hWnd property of the Form.
    The 2nd parameter is a POINTAPI structure that contains the screen coordinates and after the call it will contain the client's calculated coordinates. (all in pixels)

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