Making specific Text Boldefaced in a TextBox

前端 未结 7 1983
情歌与酒
情歌与酒 2020-11-28 12:37

Hi I currently have a texbox that prints out info to the user when they press diffrent buttons. I was wondering if there was a way to make only some of my text bolded while

7条回答
  •  日久生厌
    2020-11-28 13:27

    jwillmer's answer had a few errors for me. These were solved by adding:

    using System.Drawing;
    

    and then changing the inputs to:

    public static void ChangeTextcolor(string textToMark, System.Drawing.Color color, System.Windows.Forms.RichTextBox richTextBox, int startIndex)
    

    This was because my code was looking for System.Windows.Controls.RichTextbox not Windows.Forums.RichTextBox. And System.Windows.Media.Color not System.Drawing.Color

提交回复
热议问题