Easy to make 'Button'

Gluttard

Active member
Joined
Jan 9, 2008
Messages
44
Programming Experience
Beginner
Hey guys, I know sometimes you want a more colorful button unlike the traditional Windows Form button, so here's how you can make one pretty easily.

First of all, drag one label onto the form, and change the properties as follows:
- BackColor = Red (Or really any color you desire.)
- BorderStyle = FixedSingle
- Font:
- Size = 10
- Bold = True
- Text = Click Here!

Now, enter this code into the form:
PHP:
Public Class Form1

    Private Sub Label1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseClick
        Label1.BorderStyle = BorderStyle.FixedSingle
        'Code to perform when button is clicked below
    End Sub

    Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
        Label1.BorderStyle = BorderStyle.Fixed3D
    End Sub
End Class

Now the code really isn't what makes this in any way special, it's just that some people may not have realized that this is so easy to do.
Yup, so have fun!
By the way, the pictures aren't too pretty, but hopefully they'll get the point across.
 

Attachments

  • asdf1.GIF
    asdf1.GIF
    6.4 KB · Views: 33
  • asdf2.GIF
    asdf2.GIF
    10.1 KB · Views: 32
I would much prefer changing the BackColor of a Button control! :)
 
Hmm, very true. As it turns out, I thought of that JUST after I had posted this.
That doesn't always get the desired look though.
 
Back
Top