Results 1 to 3 of 3

Thread: Mouse Location - Not Position :RESOLVED

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    36

    Mouse Location - Not Position :RESOLVED

    I need to find the mouse cursor location X/Y on my windows control library.

    When writing a windows application I can use the following math but it does not work on a control library since I am using internet explorer to view the form instead:

    X = MousePosition.X - Me.Location.X
    Y = MousePosition.Y - Me.Location.Y

    In a windows control library the Me X/Y never changes even if internet explorer is moved. The Mouse X/Y postition is where it is at on the screen not the form.
    Last edited by DinoRoger; Nov 16th, 2003 at 10:41 AM.

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    You need to implement a PointToScreen(MousePosition) to retrieve the screen coordinates.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    36
    Found the solution:

    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove lblX.Text = "X= " + e.X.ToString lblY.Text = "Y= " + e.Y.ToString End Sub

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