Solved

Mouse Position

Posted on 2004-09-17
5
188 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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