WPF RichTextBox

2021-04-10 04:30

阅读:346

标签:doc   arp   else   document   highlight   rgb   box   +=   sharp   

 

FlowDocument RunFlowDoc = new FlowDocument();
Paragraph Runparagraph = new Paragraph();

RunFlowDoc.Blocks.Add(Runparagraph);
txtRichBox.Document = RunFlowDoc;

Run r = new Run(content);
if (type == 0)
r.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 255));
else if (type == 1)
r.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
else
r.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
Runparagraph.Inlines.Add(r);
Runparagraph.Inlines.Add("\r");
txtRichBox.ScrollToEnd();

//行内追加

Run r = Runparagraph.Inlines.ElementAt(Runparagraph.Inlines.Count - 2) as Run;
r.Text += ">>正在上传";

//加入图片 
BitmapImage bi = new BitmapImage(new Uri(@"F:\image\submit.png")); Image image = new Image(); image.Source = bi; InlineUIContainer container = new InlineUIContainer(image); Paragraph paragraph = new Paragraph(container);

  

  

WPF RichTextBox

标签:doc   arp   else   document   highlight   rgb   box   +=   sharp   

原文地址:https://www.cnblogs.com/siazon/p/9049313.html


评论


亲,登录后才可以留言!