How do I maintain RichText formatting (bold/italic/etc) when changing any one element?

后端 未结 5 816
醉酒成梦
醉酒成梦 2020-12-05 15:52

I have a rich text box that may contain a string that has elements of bold, italics, or even different fonts and sizes. If I select the entire string, including all of the d

5条回答
  •  忘掉有多难
    2020-12-05 16:27

    if you want to apply more FontStyle's on the same text you can use bitwise operators | and ~ | adds a new style and ~ removes an existing style for example

    Font aFont=new Font(aPrototypeFont, anotherFont.Style | FontStyle.Bold); 
    

提交回复
热议问题