0

When I use formatting functions (i-e bold, italic, underline, font size, font color), then the the whole document is formatted including the new text entered. But I want to use these functionalities only to format new text that is going to be entered and the selected text.

How can I do this?

LarsTech
  • 80,625
  • 14
  • 153
  • 225

1 Answers1

0

The problem can be resolve by using this code:

System.Drawing.Font currentFont = txtPAD.SelectionFont;

System.Drawing.FontStyle newFontStyle;

newFontStyle = txtPAD.SelectionFont.Style ^ FontStyle.Italic;

txtPAD.SelectionFont = new Font(currentFont.FontFamily, currentFont.Size, newFontStyle);
Code Lღver
  • 15,573
  • 16
  • 56
  • 75