Append text to the beginning in the Rich Text Box

前端 未结 3 1069
孤街浪徒
孤街浪徒 2021-01-17 13:31
private void button1_Click(object sender, EventArgs e)
{
    richTextBox1.AppendText(\"\\r\\n\");
    richTextBox1.Focus();
    string s = \"Enter \";
    richTextBo         


        
3条回答
  •  深忆病人
    2021-01-17 14:03

    previous messages seems obsolete. I solve it by :

    Paragraph newExternalParagraph = new Paragraph();
    newExternalParagraph.Inlines.Add( new Bold(new Run("[" + hour.ToString() + ":" + minute.ToString() + "]"))
    {
        Foreground = Brushes.Yellow
    });
    _consoleText.Document.Blocks.InsertBefore(_consoleText.Document.Blocks.FirstBlock , newExternalParagraph);
    

提交回复
热议问题