none
Changing the color of a button in VB studio 2005

    Question

  • I woud like to know how you change the font in a label with a button and
     how you change the button color with mouse over in VB Studio 2005

    Thank you
    Sunday, September 20, 2009 11:31 PM

Answers

  • Hi,

    This forum is meant for questions and issues regarding the installation and setup of Visual Studio.  You'd get better responses to your future Visual Basic programming questions by posting them in one of the Visual Basic forums: http://social.msdn.microsoft.com/Forums/en-US/category/visualbasic.

    To answer your questions, you can change a label font with a button click event:

    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            ' Assign a Font object — Name and Size are required.
            Label1.Font = New System.Drawing.Font("Arial", 10)
        End Sub
    End Class
    

    To change button color on mouseover event:

    Public Class Form1
    
        Private Sub Button1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
            Button1.BackColor = Color.Aquamarine
        End Sub
    
        Private Sub Button1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
            Button1.BackColor = Color.Empty
        End Sub
    End Class
    Cheers,

    - Kemp Brown [MSFT]
    Tuesday, September 22, 2009 12:40 AM