首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何获取RTF值(非纯文本值)

如何获取RTF值(非纯文本值)
EN

Stack Overflow用户
提问于 2014-02-16 17:35:34
回答 2查看 1.3K关注 0票数 0

我使用的是TX TextEditingControl (免费版),我认为这绝对是很棒的。

但我似乎不能得到我需要的RTF (文本)内容。

代码语言:javascript
复制
//Define
private TXTextControl.TextControl rtf = new  TXTextControl.TextControl();


 [...code...]

    private void button_Click(object sender, EventArgs e) {..


   //rtf.Save(s, TXTextControl.StreamType.RichTextFormat);
   //This is what I would like to do but I cant find the property or function that does this.
   string s = rtf.DocumentRTF;

   //Im expecting the standard RTF Format but I get blank
   MessageBox.Show(s);

}
EN

回答 2

Stack Overflow用户

发布于 2014-02-16 17:54:53

找到了!没有RTF属性,要获得输出,必须使用save()函数。幸运的是,你可以写到流和字符串。

代码语言:javascript
复制
       string s = "";

        rtf.Selection.Bold = true;

        //rtf.Selection.Save(TXTextControl.StreamType.RichTextFormat);

        rtf.Save(out s,TXTextControl.StringStreamType.RichTextFormat);

        MessageBox.Show(s);
票数 0
EN

Stack Overflow用户

发布于 2014-02-16 18:07:13

尊敬的朋友,请使用以下内容

对于Vb.Net

代码语言:javascript
复制
        Dim RegFont As New Font("Arial", UseFontSize, FontStyle.Bold)
        Dim VIPFont As New Font("Arial", UseFontSize, FontStyle.Bold)
        MyRitchText.SelectionFont = VIPFont
        MyRitchText.SelectionAlignment = HorizontalAlignment.Center
        MyRitchText.SelectionColor = Color.Green

对于c#

代码语言:javascript
复制
        Font RegFont = new Font("Arial", UseFontSize, FontStyle.Bold);
        Font VIPFont = new Font("Arial", UseFontSize, FontStyle.Bold);
        MyRitchText.SelectionFont = VIPFont;
        MyRitchText.SelectionAlignment = HorizontalAlignment.Center;
        MyRitchText.SelectionColor = Color.Green;

谢谢:D

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21809526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档