How can I change the font size only of a label's text property by clicking on a button. Basically, I want two buttons. One to increase the size and one to decrease the size.
Printable View
How can I change the font size only of a label's text property by clicking on a button. Basically, I want two buttons. One to increase the size and one to decrease the size.
VB Code:
Dim x As Integer Dim f As String '///^^^ referenced so available from all controls. '////////// Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click x = Label1.Font.Size f = Label1.Font.Name Label1.Font = New Drawing.Font(f, x + 1) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click x = Label1.Font.Size f = Label1.Font.Name Label1.Font = New Drawing.Font(f, x - 1) End Sub
to increase:
Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size + 1)
to decreace:
Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size - 1)
damn.. beat me to it!
lol , must have my finger on the trigger today:cool:
Howdy Gunslingers!
Both responses are greatly appreciated!
Thanks!