Solved

Mouse Position

Posted on 2004-09-17
5
186 Views
Last Modified: 2010-04-23
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
Comment
Question by:anitahelp
  • 3
  • 2
5 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 12087040
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
 

Author Comment

by:anitahelp
ID: 12087101
When does the MouseMove event fire?  Didn't seem to work for me.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 12087105
Sorry,

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

Idle_Mind
0
 

Author Comment

by:anitahelp
ID: 12087134
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
 

Author Comment

by:anitahelp
ID: 12087140
works great!  thank you!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now