Set The Font Effect To Selected Text in RichTextBox


 

//For Regular(Without Any Effect) :

 

Font myFont = new Font(RichTextBox1.Font, FontStyle.Regular);

RichTextBox1.SelectionFont = myFont;

 

 

 

//For Bold Effect :

 

Font myFont = new Font(RichTextBox1.Font, FontStyle.Bold);

RichTextBox1.SelectionFont = myFont;

 

 

 

//For Italic Effect :

 

Font myFont = new Font(RichTextBox1.Font, FontStyle.Italic);

RichTextBox1.SelectionFont = myFont;

 

 

 

//For Underline Effect :

 

Font myFont = new Font(RichTextBox1.Font, FontStyle.Underline);

RichTextBox1.SelectionFont = myFont;

 

 

 

//For Strikeout Effect :

 

Font myFont = new Font(RichTextBox1.Font, FontStyle.Strikeout);

RichTextBox1.SelectionFont = myFont;


Ebook Download
View all
Learn
View all