[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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