zoukankan      html  css  js  c++  java
  • 在C#中如何将多个rtf文件内容组合在一起用一个rtf文件保存?

            //重点为是使用 SelectedRtf  属性
            private void button1_Click( object sender, EventArgs e )
            {
                //mergeRTF为并内容后的 RichTextBox 控件
                mergeRTF.SelectionLength = 0;       //不选内容
    
    
                RichTextBox rtf = new RichTextBox();        //需要合并的RTF
                StringBuilder s = new StringBuilder();
    
                //第一个RTF文件
                rtf.Text = "C#程序设计";
                rtf.SelectAll();
    
                Font f = null;
                f = new Font( "宋体", 12 ,FontStyle.Bold);
    
                rtf.SelectionFont = f;      //字体
                rtf.SelectionColor = Color.Red;
    
                //加入
                mergeRTF.SelectedRtf = rtf.SelectedRtf;
    
                //第二个RTF文件
                rtf.Text = "VB.NET程序设计";
                rtf.SelectAll();
    
                f = new Font( "楷体", 10, FontStyle.Italic );
    
                rtf.SelectionFont = f;      //字体
                rtf.SelectionColor = Color.Gray;
    
                //加入
                mergeRTF.SelectedRtf = rtf.SelectedRtf;
    
                //第三个RTF文件
                rtf.Text = "美利坚合众国";
                rtf.SelectAll();
    
                f = new Font( "黑体", 25, FontStyle.Underline | FontStyle.Bold | FontStyle.Italic );
    
                rtf.SelectionFont = f;      //字体
                rtf.SelectionColor = Color.Blue;
    
                //加入
                mergeRTF.SelectedRtf = rtf.SelectedRtf;
    
                //第N个
                //。。。。
    
    
    
            }
  • 相关阅读:
    用免费Scrum工具Leangoo思维导图 实现影响地图
    mysql-线程模型
    mongodb-锁
    mongodb-mmapv1存储引擎解析(转)
    netty-read
    netty-bind
    netty-eventloop
    java基础-Executor
    ehcache3-源码简析三
    ehcache3-源码简析二
  • 原文地址:https://www.cnblogs.com/China3S/p/6213387.html
Copyright © 2011-2022 走看看