TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bob Gatto
NA
44
8.2k
how do I change font style of selected text ONLY in a rich text box?
Dec 18 2020 6:54 AM
I have a rich text box on my form and all I want the user to select an area of text, click on a 'B' icon and set only the selected text to bold. And after that when they continue to type the bold setting should be turned off and the previous font setting should be used.
The code I'm using is this:
Font fnt =
new
Font(richTextBox1.Font, FontStyle.Bold);
richTextBox1.SelectionFont = fnt;
And this does set the selected text to bold. However, when I continue typing, bold is still set.
So how do I turn off the bold and leave the font settings as they were before the selection?
Thanks for the help.
Reply
Answers (
2
)
Checkbox remain checked after getting the result
How to rotate the label?