B
Bill English
One last question before I go to bed...
So far I have only programmed one style button for my
text. This is the code I have for my Bold button.
If Not rtb.SelectionFont Is Nothing Then
Dim currentFont As System.Drawing.Font =
rtb.SelectionFont
Dim newFontStyle As System.Drawing.FontStyle
If rtb.SelectionFont.Bold = True Then
buttonbold.Pushed = False
newFontStyle = FontStyle.Regular
Else
buttonbold.Pushed = True
newFontStyle = FontStyle.Bold
End If
rtb.SelectionFont = New Font
(currentFont.FontFamily, currentFont.Size, newFontStyle)
rtbfont.Font = New Font
(currentFont.FontFamily, currentFont.Size, newFontStyle)
End If
Now my problem is, when this button is clicked, it
creates a new font, and it applies it to the textbox.
But when I add this code to the other buttons, they will
also create a new font. Which will mean, I can only use
one font style at once. How am I supposed to go about
programming the other buttons.
So far I have only programmed one style button for my
text. This is the code I have for my Bold button.
If Not rtb.SelectionFont Is Nothing Then
Dim currentFont As System.Drawing.Font =
rtb.SelectionFont
Dim newFontStyle As System.Drawing.FontStyle
If rtb.SelectionFont.Bold = True Then
buttonbold.Pushed = False
newFontStyle = FontStyle.Regular
Else
buttonbold.Pushed = True
newFontStyle = FontStyle.Bold
End If
rtb.SelectionFont = New Font
(currentFont.FontFamily, currentFont.Size, newFontStyle)
rtbfont.Font = New Font
(currentFont.FontFamily, currentFont.Size, newFontStyle)
End If
Now my problem is, when this button is clicked, it
creates a new font, and it applies it to the textbox.
But when I add this code to the other buttons, they will
also create a new font. Which will mean, I can only use
one font style at once. How am I supposed to go about
programming the other buttons.