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(" "); txtRichBox.ScrollToEnd(); //行内追加 Run r = Runparagraph.Inlines.ElementAt(Runparagraph.Inlines.Count - 2) as Run; r.Text += ">>正在上传";
//加入图片
BitmapImage bi = new BitmapImage(new Uri(@"F:imagesubmit.png")); Image image = new Image(); image.Source = bi; InlineUIContainer container = new InlineUIContainer(image); Paragraph paragraph = new Paragraph(container);