Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Mouse Position

Hello Again (you guys are the greatest!)

Ok, I am making a user control that needs to work like a togle switch (3 pos).  What I would like to do is if the mouse is hovering in the top 1/3 of the control set my cursor to an up arrow, if it is middle 1/3 a plus cursor, and the botton 1/3 a down arrow.  Any ideas on how to accomplish something like this?
0
anitahelp
Asked:
anitahelp
  • 3
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Perhaps something like this will work:

    Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
        If e.X < Me.Height / 3 Then
            Me.Cursor = Cursors.PanNorth
        ElseIf e.X < Me.Height * 2 / 3 Then
            Me.Cursor = Cursors.Cross
        Else
            Me.Cursor = Cursors.PanSouth
        End If
    End Sub
0
 
anitahelpAuthor Commented:
When does the MouseMove event fire?  Didn't seem to work for me.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Sorry,

Should be using e.Y instead of e.X.

Idle_Mind
0
 
anitahelpAuthor Commented:
sorry, bad question, i can get it to change to PanNorth but not pan south, it will give me the cross off to the right
0
 
anitahelpAuthor Commented:
works great!  thank you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now