• WPF RichTextBox


    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);

      

      

  • 相关阅读:
    14.3
    14.2
    14.1
    第14章 抽象类和接口
    13.5
    JAVA异常处理
    12.9
    12.7
    vs 常用快捷键
    click()和onclick()的区别
  • 原文地址:https://www.cnblogs.com/siazon/p/9049313.html
Copyright © 2020-2023  润新知