RichTextBox font style button for Bold and/or Italic (how to code so more than one can be chosen instead of replacing

前端 未结 5 956
小鲜肉
小鲜肉 2021-01-27 19:48

Right now I am using some buttons with the following code:

richTextBox1.SelectionFont = new Font(\"Tahoma\", 12, FontStyle.Bold);
richTextBox1.SelectionColor = S         


        
5条回答
  •  萌比男神i
    2021-01-27 20:46

    you need to do something like this..

    in order ot make it italic.

     richTextBox1.SelectionFont = new Font("Tahoma", 12, richTextBox1.SelectionFont.Style | FontStyle.Italic);
    

    //in order to make it bold

    richTextBox1.SelectionFont = new Font("Tahoma", 12, richTextBox1.SelectionFont.Style | FontStyle.Bold);
    

提交回复
热议问题