Form's MouseMove event handler

Started by nandagopal, May 18, 2009, 04:33 PM

Previous topic - Next topic

nandagopal

This example displays a borderless textual button that grows when the mouse is over it so you can tell what will happen if you click.

Use a Label control. In the MouseMove event handler, change the label text to make it bigger. In the Form's MouseMove event handler, make the buttons small again.


Private Sub Form_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    Label1.Caption = "[yes]"
    Label2.Caption = "[no]"
End Sub

Private Sub Label1_Click()
    Unload Me
End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    Label1.Caption = "[YES]"
    Label2.Caption = "[no]"
End Sub

Private Sub Label2_Click()
    MsgBox "You pressed the NO button and choosed not to " & _
        "quit!", vbInformation, "Button Pressed"
End Sub

Private Sub Label2_MouseMove(Button As Integer, Shift As _
    Integer, X As Single, Y As Single)
    Label2.Caption = "[NO]"
    Label1.Caption = "[yes]"
End Sub