locked
Issue with mouse position and object position RRS feed

  • Question

  • Having a issue with mouse position vs. object position. Basicly the object moves to the forums location and the mouse moves tot he pc's location. Since the size of the forum is smaller, the positions are different. So how do I change this to move the mouse based on the forums location and not the screen location.

    Current code:

    Private Sub box1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles box1.Click
            box1.Location = New Point(100, 100)
            Windows.Forms.Cursor.Position = New System.Drawing.Point(box1.Location)
            Label1.Text = box1.Location.ToString
        End Sub

    Monday, October 22, 2012 11:49 PM

Answers

All replies

  • NM please close
    • Marked as answer by mholmes_3038 Tuesday, October 23, 2012 12:20 AM
    Tuesday, October 23, 2012 12:20 AM
  • try this:

    box1.Location = New Point(100, 100)
    Cursor.Position = Me.PointToScreen(box1.Location)
    Label1.Text = box1.Location.ToString


    thanks for any help

    Tuesday, October 23, 2012 12:20 AM