473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Font Styles

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.
Nov 20 '05 #1
2 1689
Hi Bill,

Is this togling of a bold button what you want to do?
\\\
If Button1.Font.Style <> FontStyle.Bold Then
Button1.Font = New Font(Button1.Font, FontStyle.Bold)
Else
Button1.Font = New Font(Button1.Font, FontStyle.Regular)
End If
////
Or did you came to something yourself after a good sleep?
:-)
Cor
Nov 20 '05 #2
* "Bill English" <nu****@comcast.net> scripsit:
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.


\\\
Dim f As New Font(Me.Font, Me.Font.Style Or FontStyle.Italic)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Viken Karaguesian | last post by:
Hello all, It stinks being a newbie! One thing that I'm not sure about with CSS is: where is the "proper" place to put font attibutes? This has me a little confused. Take the below style sheet...
6
by: Tim | last post by:
Hi Guys, I want to build a font like so: headerFont = new Font("Times New Roman", 10, FontStyle.Underline | FontStyle.Bold); It is going to be built dynamically from the DB. How do I build...
12
by: newspost2000 | last post by:
http://www.htmldog.com/articles/elasticdesign/demo/ I found this wonderful site the demonstrates how you cannnot resize text formated using styles in ie 6 if you specify font size using pt units...
58
by: Don Li | last post by:
I've tried <body style="font-family:Verdana,Arial,Helvetica;font-size:0.8em;"> or <body style="font-family:Verdana,Arial,Helvetica;font-size:11pct;"> or <body...
14
by: Roedy Green | last post by:
Is there a shortcut way to define the default font family (and characteristics) to be applied to all styles? -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.