Wednesday 15 June 2011

c# - RichTextBox SelectionFont change back -


I am creating a rich textbox and I've got this code:

  richTextBox1.SelectionFont = New font ("Wordana", 10, font style. Regular); RichTextBox1.SelectionColor = Color.blue; RichTextBox1.Text + = "ddddd";   

The text remains the same I have seen that RichTextBox1.Text changes my font back to the default font. How can I fix this?

Try using the attribute method:

  rich textbox 1. Selection fonts = new font ("vardana", 10, font style. Regular); RichTextBox1.SelectionColor = Color.blue; RichTextBox1.AppendText ("ddddd"); RichTextBox1.SelectionFont = myDefaultFont; RichTextBox1. SelectionColor = myDefaultColor;    

No comments:

Post a Comment