Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a button that grows when the mouse is over it
Keywordsbutton, grow, label
CategoriesControls
 
Thanks to Jakob Kofod.

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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated