Change font of text in richtextbox

后端 未结 1 503
甜味超标
甜味超标 2021-01-12 20:40

My text is in a richtextbox:


First text of parag1. Second text of parag1.
         


        
1条回答
  •  花落未央
    2021-01-12 21:21

    You would need to select parts of text and use SelectionColorand SelectionFontproperties. Everything is explained here.

    Hope this helps

    Now for your other question, if you mean how to change the font and color of the text inserted while the program is running, try this.

             private void someTextBox_KeyPress(object sender, KeyPressEventArgs e)
             {
               this.someTextBox.SelectionColor = Color.Blue; 
               // Same goes for font and other properties
             }
    

    I don't have time to test it so I don't know how it will act with the other colors you previously set.

    0 讨论(0)
提交回复
热议问题