Solved

Mouse Position

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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