码迷,mamicode.com
首页 > Windows程序 > 详细

WPF RichTextBox

时间:2018-05-17 11:44:34      阅读:247      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!