using mousemove properties

How does the Form_MouseMove sub work? Say I wanted Frame1.visible = true whenever the X coordinate of the mouse is >= 8 and <= 32, and the Y coordinate >= 8 and <= 32, how would I do that?

Better yet, is there something like Private Sub Img1_Hover()? That will run as long as the user has the mouse hovering over Img1?

Comments

  • The MouseMove event triggers whenever the mouse is moved over the object so it's relatively simple to have something happen whenever the mouse pointer is over an object. Try the following:

    Place a command button, a list box and a label on a form and add the following code:

    [code]Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = "Command 1"
    End Sub

    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = ""
    End Sub

    Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = "List 1"
    End Sub[/code]

    Move the mouse over the button and the list box. The label will change to show whether the mouse is over the command button or the list box. When the mouse is over the form the label is blank.

    Keilor.


    : How does the Form_MouseMove sub work? Say I wanted Frame1.visible = true whenever the X coordinate of the mouse is >= 8 and <= 32, and the Y coordinate >= 8 and <= 32, how would I do that?
    :
    : Better yet, is there something like Private Sub Img1_Hover()? That will run as long as the user has the mouse hovering over Img1?
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion