zoukankan      html  css  js  c++  java
  • SOS:利用WPF RichTextBox 提取RTF, 莫名丢掉了Underline样式信息

    主代码是这样写的:

     1richTextBox1.SelectAll();
     2richTextBox1.Selection.ApplyPropertyValue(Inline.TextDecorationsProperty, TextDecorations.Underline);
     3System.Drawing.FontStyle style = richTextBox1.DrawingFontStyle();
     4MessageBox.Show(style.ToString());     // <-- result: Underline
     5
     6string rtf = richTextBox1.RTF();
     7richTextBox1.LoadFromRTF(rtf);
     8richTextBox1.SelectAll();
     9style = richTextBox1.DrawingFontStyle();
    10MessageBox.Show(style.ToString());    // <--  result: Regular    
    11

    运行的结果:
    第一次显示: Underline
    第二次显示: Regular
    而RichTextBox里的字体始终是带有下划线的。个人分析的结果为 RichTextBox 提取RTF的字符串丢掉了Underline样式, 那么改如何修正呢?

    提取RTF字符串:

    RTF Extension

    读取RTF:

    Load RTF

     解析FontStyle:

    Get FontStyle

    完整的Source:/Files/anders06/RTFConvertor.zip

  • 相关阅读:
    【20171030早】sqli-libs Less7-15 练习
    【20171029中】sqli-libs 注入的过程 less1-4
    【20171028早】ubuntu 16.04 LTS 安装php遇到的问题
    【20171027早】alert(1) to win 第9,10,11,12题
    【20171026早】alert(1) to win
    【20171025晚】alert(1) to win 第五题 正则表达式过滤
    【20171025中】alert(1) to win 脚本渲染自建
    【20171025早】alert(1) to win 练习
    mysql 导入 excel 数据
    我的书单
  • 原文地址:https://www.cnblogs.com/anders06/p/1506889.html
Copyright © 2011-2022 走看看