当前位置: 首页>>代码示例>>C#>>正文


C# RichTextBox.SaveFile方法代码示例

本文整理汇总了C#中System.Windows.Forms.RichTextBox.SaveFile方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.SaveFile方法的具体用法?C# RichTextBox.SaveFile怎么用?C# RichTextBox.SaveFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.RichTextBox的用法示例。


在下文中一共展示了RichTextBox.SaveFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SqlConnection

        void 中译英入题目表()
        {
            SqlConnection conn = new SqlConnection(login.sqlName);
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "new_教师英语词组_中译英";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("timuWenBen", SqlDbType.VarChar).Value = textBox2.Text.Trim() + textBox1.Text.Trim();
            cmd.Parameters.Add("teacherName", SqlDbType.NVarChar).Value = login.teacherName;
            //cmd.Parameters.Add("wentiYinPin", SqlDbType.NVarChar).Value = "无";
            cmd.Parameters.Add("cizuID", SqlDbType.NVarChar).Value = cizuID;
            cmd.Parameters.Add("nianji", SqlDbType.NVarChar).Value = comboBox1.Text;
            cmd.Parameters.Add("danyuan", SqlDbType.NVarChar).Value = comboBox2.Text;
            cmd.Parameters.Add("zhongYiyingID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();
            id中译英 = (int)cmd.Parameters["zhongYiyingID"].Value;
            conn.Dispose();
            cmd.Dispose();

            RichTextBox rtb问题 = new RichTextBox();
            rtb问题.Font = new Font("微软雅黑", 30);
            rtb问题.Text = textBox2.Text;
            rtb问题.SelectAll();
            rtb问题.SaveFile(login.qfold + id中译英, RichTextBoxStreamType.RichText);

            RichTextBox rtb答案 = new RichTextBox();
            rtb答案.Font = new Font("微软雅黑", 35);
            rtb答案.ForeColor = Color.Red;
            rtb答案.Text = textBox1.Text + "\n";
            rtb答案.SelectAll();

            RichTextBox eg1Eng = new RichTextBox();
            eg1Eng.Font = new Font("微软雅黑", 20);
            eg1Eng.Text = textBox3.Text;

            RichTextBox eg1Ch = new RichTextBox();
            eg1Ch.Font = new Font("楷体", 15);
            eg1Ch.ForeColor = Color.Gray;
            eg1Ch.Text = textBox4.Text + "\n";

            RichTextBox eg2Eng = new RichTextBox();
            eg2Eng.Font = new Font("微软雅黑", 20);
            eg2Eng.Text = textBox5.Text;

            RichTextBox eg2Ch = new RichTextBox();
            eg2Ch.Font = new Font("楷体", 15);
            eg2Ch.ForeColor = Color.Gray;
            eg2Ch.Text = textBox6.Text;

            RichTextBox rtb合并 = new RichTextBox();
            rtb合并.SelectedRtf = rtb问题.Rtf;
            rtb合并.SelectedRtf = rtb答案.Rtf;
            rtb合并.SelectedRtf = eg1Eng.Rtf;
            rtb合并.SelectedRtf = eg1Ch.Rtf;
            rtb合并.SelectedRtf = eg2Eng.Rtf;
            rtb合并.SelectedRtf = eg2Ch.Rtf;

            rtb合并.SaveFile(login.afold + id中译英, RichTextBoxStreamType.RichText);
        }
开发者ID:hank87,项目名称:testTeacher,代码行数:59,代码来源:英语词组.cs

示例2: AddRtf

 public void AddRtf(string rtf)
 {
     string path = RandomPath;
     System.Windows.Forms.RichTextBox richTextBox = new System.Windows.Forms.RichTextBox();
     richTextBox.Rtf = rtf;
     richTextBox.SaveFile(path);
     InsertFile(path);
 }
开发者ID:callme119,项目名称:civil,代码行数:8,代码来源:WinWordControlEx.cs

示例3: ExportFiles

 public static void ExportFiles(RichTextBox richTextBox1)
 {
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     saveFileDialog1.Filter = "Word Files|*.doc|RTF Files|*.rtf|txt Files|*.txt|所有文件|*.*";
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         if ((System.IO.Path.GetExtension(saveFileDialog1.FileName)).ToLower() == ".txt")
             richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
         else if ((System.IO.Path.GetExtension(saveFileDialog1.FileName)).ToLower() == ".doc")
         {
             FileStream fs = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate);
             StreamWriter sw = new StreamWriter(fs);
             sw.Write(richTextBox1.Rtf);
             sw.Flush();
             sw.Close();
         }
         else
         {
             richTextBox1.SaveFile(saveFileDialog1.FileName,RichTextBoxStreamType.RichText);
         }
     }
 }
开发者ID:JoshuaHe2015,项目名称:VISAP2.0_GUI,代码行数:22,代码来源:ReportV.cs

示例4: ProcessTemplate

        private Dictionary<String, MemoryStream> ProcessTemplate()
        {
            MemoryStream plantillaStream = new MemoryStream();
            Dictionary<String, MemoryStream> listStream = new Dictionary<String, MemoryStream>();

            //Extraemos la plantilla
                //Se modifican las fechas una sola vez en la plantilla
            using (richText = new RichTextBox())
            {
                richText.LoadFile(invitacionUri);
                SearchAndReaplaceRTF("[[Fecha Invitacion]]", wordDateInfo.FechaInvitacion.ToString(FORMAT_DATE));
                SearchAndReaplaceRTF("[[Fecha Mediacion]]", wordDateInfo.FechaMediacion.ToString(FORMAT_DATE));
                SearchAndReaplaceRTF("[[Hora Mediacion]]", String.Format("{0} a {1}", wordDateInfo.HoraInicio.ToString(FORMAT_HOUR_INITIAL),
                        wordDateInfo.HoraFinal.ToString(FORMAT_HOUR_FINAL)));

                richText.SaveFile(plantillaStream, RichTextBoxStreamType.RichText);
            }

            foreach (WordInfo info in wordList)
            {
                MemoryStream memoryFile = new MemoryStream();

                using (richText = new RichTextBox())
                {
                    plantillaStream.Position = 0;
                    richText.LoadFile(plantillaStream, RichTextBoxStreamType.RichText);
                    SearchAndReaplaceRTF("[[NOMBRE]]", info.Nombre);
                    SearchAndReaplaceRTF("[[DIRECCION]]", info.DireccionCompleta);
                    SearchAndReaplaceRTF("[[CREDITO]]", info.Credito.ToString());

                    richText.SaveFile(memoryFile, RichTextBoxStreamType.RichText);
                }

                listStream.Add(info.Nombre, memoryFile);
            }

            return listStream;
        }
开发者ID:rockbass2560,项目名称:inmobiliariairvingmobile,代码行数:38,代码来源:WordManager.cs

示例5: Log

        /// <summary>
        /// Write a new log entry with the specified category and priority.
        /// </summary>
        /// <param name="log">The log item to log.</param>
        public void Log(ILog log)
        {
            if (log == null) { throw new ArgumentException("log"); }

            if (DateTime.Now.Date != this.logDate)
            {
                this.logDate = DateTime.Now.Date;
                this.fileName = string.Format(ConstLogFileNameFormat, this.logDate.ToString("yyyy-MM-dd"));
            }

            using (RichTextBox output = new RichTextBox())
            {
                output.Rtf = String.Empty;

                if (File.Exists(this.fileName))
                    output.LoadFile(this.fileName, RichTextBoxStreamType.RichText);

                output.Select(output.Text.Length, 0);
                output.SelectedRtf = FormatLogRTF(log) + Environment.NewLine;

                output.SaveFile(this.fileName, RichTextBoxStreamType.RichText);
            }
        }
开发者ID:BigEgg,项目名称:Core,代码行数:27,代码来源:RTFLogger.cs

示例6: RichTextBox

        void 听录音存入数据库()
        {
            RichTextBox rtb7 = new RichTextBox();

            //存英中文答案
            rtb7.Text = textBox3.Text +"\n"+ textBox1.Text;
            rtb7.SelectAll();
            rtb7.SelectionFont = new Font("微软雅黑", 35);
            rtb7.SelectionColor = Color.Red;
            RichTextBox rtb9 = new RichTextBox();
            rtb9.SelectedRtf = rtb7.Rtf;
            rtb9.SelectedRtf = this.richTextBox1.Rtf;

            //存入数据库
            SqlConnection conn = new SqlConnection(login.sqlName);
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "new_教师录英语词汇_单词中译英";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("teacherName", SqlDbType.NVarChar).Value = login.teacherName;
            cmd.Parameters.Add("tixing", SqlDbType.NVarChar).Value = "听录音,默写英文和中文";
            cmd.Parameters.Add("wentiYinPin", SqlDbType.NVarChar).Value = audioStr;
            cmd.Parameters.Add("zhangjie", SqlDbType.NVarChar).Value = str章节;
            cmd.Parameters.Add("daanYinPin", SqlDbType.NVarChar).Value = "无";
            cmd.Parameters.Add("题目文本", SqlDbType.NVarChar).Value = rtb7.Text.Trim();
            cmd.Parameters.Add("id", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();
            questionID听录音 = (int)cmd.Parameters["id"].Value;

            //题号存入词汇表
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = string.Format("update 英语词汇表 set 听录音ID = {0} where id = {1}", questionID听录音, 词汇ID);
            cmd.ExecuteNonQuery();

            //存储文件
            rtb8.SaveFile(login.qfold + questionID听录音, RichTextBoxStreamType.RichText);
            rtb9.SaveFile(login.afold + questionID听录音, RichTextBoxStreamType.RichText);
        }
开发者ID:hank87,项目名称:testTeacher,代码行数:38,代码来源:录英语词汇.cs

示例7: SaveNoteFile

 internal static void SaveNoteFile(RichTextBox edit, string path)
 {
     try
     {
         edit.SaveFile(path, RichTextBoxStreamType.RichText);
         if (PNStatic.Settings.Protection.PasswordString.Length > 0 && PNStatic.Settings.Protection.StoreAsEncrypted)
         {
             using (var pne = new PNEncryptor(PNStatic.Settings.Protection.PasswordString))
             {
                 pne.EncryptTextFile(path);
             }
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
开发者ID:hyrmedia,项目名称:PNotes.NET,代码行数:18,代码来源:PNNotesOperations.cs

示例8: SqlConnection

        void 题目默()
        {
            SqlConnection conn = new SqlConnection(login.sqlName);
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "new_教师音标拼读_题目默";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("yinbiao", SqlDbType.NVarChar).Value = textBox1.Text.Trim();
            cmd.Parameters.Add("pinduID", SqlDbType.Int).Value = pinduID;
            cmd.Parameters.Add("timuID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("teacherName", SqlDbType.NVarChar).Value = login.teacherName;
            cmd.ExecuteNonQuery();
            id默 = (int)cmd.Parameters["timuID"].Value;
            conn.Dispose();

            RichTextBox rtb1 = new RichTextBox();
            rtb1.Font = new Font("Lucida Sans Unicode", 70);
            rtb1.SaveFile(login.qfold + id默, RichTextBoxStreamType.RichText);
            rtb1.Text = textBox1.Text.Trim();
            rtb1.SelectAll();
            rtb1.SelectionAlignment = HorizontalAlignment.Center;

            RichTextBox rtb2 = new RichTextBox();
            rtb2.Font = new Font("微软雅黑", 20);
            rtb2.Text = "\n" + this.textBox2.Text.Trim() + "  " + this.textBox3.Text.Trim();

            RichTextBox rtb3 = new RichTextBox();
            rtb3.Font = new Font("Lucida Sans Unicode", 20);
            rtb3.Text = this.textBox4.Text.Trim();
            int startPosition1 = rtb3.Find(textBox1.Text.Trim());
            rtb3.SelectionStart = startPosition1;
            rtb3.SelectionLength = textBox1.Text.Trim().Length;
            rtb3.SelectionColor = Color.Red;

            RichTextBox rtb4 = new RichTextBox();
            RichTextBox rtb5 = new RichTextBox();
            if (textBox5.Text.Trim() != "")
            {

                rtb4.Font = new Font("微软雅黑", 20);
                rtb4.Text = "\n" + this.textBox5.Text.Trim() + "  " + this.textBox6.Text.Trim();

                rtb5.Font = new Font("Lucida Sans Unicode", 20);
                rtb5.Text = this.textBox7.Text.Trim();
                int startPosition2 = rtb5.Find(textBox1.Text.Trim());
                rtb5.SelectionStart = startPosition2;
                rtb5.SelectionLength = textBox1.Text.Trim().Length;
                rtb5.SelectionColor = Color.Red;
            }

            RichTextBox rtb8 = new RichTextBox();
            rtb8.SelectedRtf = rtb1.Rtf;
            rtb8.SelectedRtf = rtb2.Rtf;
            rtb8.SelectedRtf = rtb3.Rtf;
            if (textBox5.Text.Trim() != "")
            {
                rtb8.SelectedRtf = rtb4.Rtf;
                rtb8.SelectedRtf = rtb5.Rtf;
            }
            rtb8.SaveFile(login.afold + id默, RichTextBoxStreamType.RichText);
        }
开发者ID:hank87,项目名称:testTeacher,代码行数:61,代码来源:音标拼读.cs

示例9: luufile

 private void luufile(RichTextBox richTextBox1, string p)
 {
     richTextBox1.SaveFile(p, RichTextBoxStreamType.PlainText);
 }
开发者ID:tranquangchau,项目名称:cshap-2008-2013,代码行数:4,代码来源:Form1.cs

示例10: OutputCachedLogs

        /// <summary>
        /// Output the cached logs
        /// </summary>
        /// <param name="state">Use for TimerCallback Class, will not use in the method</param>
        private void OutputCachedLogs(Object state)
        {
            //  Return if there don't have any logs to output
            if (this.cachedLogs.Any())
                return;

            lock (lockthis)
            {
                using (RichTextBox output = new RichTextBox())
                {
                    output.Rtf = String.Empty;

                    if (File.Exists(this.fileName))
                        output.LoadFile(this.fileName, RichTextBoxStreamType.RichText);

                    foreach (ILog log in this.cachedLogs.Where(l => l.Time.Date == this.logDate))
                    {
                        output.Select(output.Text.Length, 0);
                        output.SelectedRtf = FormatLogRTF(log) + Environment.NewLine;
                    }

                    output.SaveFile(this.fileName, RichTextBoxStreamType.RichText);
                }

                if (this.cachedLogs.Any(l => l.Time.Date != this.logDate))
                {
                    this.fileName = string.Format(ConstLogFileNameFormat, this.logDate.ToString("yyyy-MM-dd"));

                    using (RichTextBox output = new RichTextBox())
                    {
                        output.Rtf = String.Empty;

                        if (File.Exists(this.fileName))
                            output.LoadFile(this.fileName, RichTextBoxStreamType.RichText);

                        foreach (ILog log in this.cachedLogs.Where(l => l.Time.Date != this.logDate))
                        {
                            output.Select(output.Text.Length, 0);
                            output.SelectedRtf = FormatLogRTF(log) + Environment.NewLine;
                        }

                        output.SaveFile(this.fileName, RichTextBoxStreamType.RichText);
                    }

                    this.logDate = DateTime.Now.Date;
                }

                //  Clear cached logs
                this.cachedLogs.Clear();
            }
        }
开发者ID:BigEgg,项目名称:Core,代码行数:55,代码来源:RtfWithCacheLogger.cs

示例11: exportDoc


//.........这里部分代码省略.........
                            DescriptionAttribute myAttribute = (DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
                            if (myAttribute.Description.Contains(s[1]) || s[1].Contains(myAttribute.Description))
                            {
                                string txt= Convert.ToString(pro.GetType().GetProperty(des.Name).GetValue(pro, null));
                                //保留小数位数
                                if (decimals > -1)
                                {
                                    switch (myAttribute.Description)
                                    {
                                        case "零部件密度":
                                        case "零部件体积":
                                        case "零部件质量":
                                        case "零部件面积":
                                        case "零部件重心X":
                                        case "零部件重心Y":
                                        case "零部件重心Z":
                                        case "零部件惯性矩阵IXX":
                                        case "零部件惯性矩阵IXY":
                                        case "零部件惯性矩阵IXZ":
                                        case "零部件惯性矩阵IYX":
                                        case "零部件惯性矩阵IYY":
                                        case "零部件惯性矩阵IYZ":
                                        case "零部件惯性矩阵IZX":
                                        case "零部件惯性矩阵IZY":
                                        case "零部件惯性矩阵IZZ":
                                            txt=Convert.ToDouble(txt).ToString("e" + decimals);
                                            //txt=Math.Round(Convert.ToDouble(txt), decimals).ToString();
                                            break;
                                        case "质量百分比":
                                            txt=txt.Substring(0, txt.Length - 1);
                                            txt=Convert.ToDouble(txt).ToString("e" + decimals) + "%";
                                            break;
                                    }
                                }

                                //是否增加单位
                                if (isUnit)
                                {
                                    switch (myAttribute.Description)
                                    {
                                        case "零部件密度":
                                            txt += "kg/m³";
                                            break;
                                        case "零部件体积":
                                            txt += "m³";
                                            break;
                                        case "零部件质量":
                                            txt += "kg";
                                            break;
                                        case "零部件面积":
                                            txt += "m²";
                                            break;
                                        case "零部件重心X":
                                        case "零部件重心Y":
                                        case "零部件重心Z":
                                            txt += "m";
                                            break;
                                        case "零部件惯性矩阵IXX":
                                        case "零部件惯性矩阵IXY":
                                        case "零部件惯性矩阵IXZ":
                                        case "零部件惯性矩阵IYX":
                                        case "零部件惯性矩阵IYY":
                                        case "零部件惯性矩阵IYZ":
                                        case "零部件惯性矩阵IZX":
                                        case "零部件惯性矩阵IZY":
                                        case "零部件惯性矩阵IZZ":
                                            txt += "kg*m²";
                                            break;
                                    }
                                }
                                text = txt;
                                valid = false;
                                break;
                            }
                        }
                        //// Gets the attributes for the property.
                        //AttributeCollection attributes =TypeDescriptor.GetProperties(this.partProperties)["MyImage"].Attributes;
                        ///* Prints the description by retrieving the DescriptionAttribute
                        // * from the AttributeCollection. */
                        //DescriptionAttribute myAttribute =(DescriptionAttribute)attributes[typeof(DescriptionAttribute)];
                        //Console.WriteLine(myAttribute.Description);

                        richTextBox.SelectedText = text;
                        break;
                    }

                }

                if (valid)
                {
                    richTextBox.SelectedText = "";
                    v1 = true;
                }
            }
            if (v1)
            {
                MessageBox.Show("数据不匹配");
            }
            richTextBox.SaveFile(fileName);
        }
开发者ID:algz,项目名称:WeightDesignReportAssistant,代码行数:101,代码来源:MainForm.DocTemplate.cs

示例12: WriteRTFCacheLogs

        /// <summary>
        /// Write the Cache logs and the Error Cache log to the Regular log file.
        /// </summary>
        private void WriteRTFCacheLogs()
        {
            //  If the Output Setting is not the LoggerOutput.Regular.
            if (_OutputSetting != LoggerOutputSetting.RTF)
            {
                AddLog("The Output is not RTF, output have error.",
                    "Logger::WriteRTFCacheLogs()", LogType.Debug);
                return;
            }

            lock (lockthis)
            {
                AddLog("Lock the list and output the logs.",
                    "Logger::WriteRTFCacheLogs()", LogType.Debug);

                //  When the log cache have items
                if (_LogsCache.Count != 0)
                {
                    try
                    {
                        RichTextBox output = new RichTextBox();
                        output.Rtf = String.Empty;

                        if (File.Exists(_LogFilePath + "\\" + ConstLogFileName + ".rtf"))
                            output.LoadFile(_LogFilePath + "\\" + ConstLogFileName + ".rtf", RichTextBoxStreamType.RichText);

                        foreach (Log _log in _LogsCache)
                        {
                            output.Select(output.Text.Length, 0);
                            output.SelectedRtf = FormatLogRTF(_log) + "\r\n";
                        }

                        output.SaveFile(_LogFilePath + "\\" + ConstLogFileName + ".rtf", RichTextBoxStreamType.RichText);

                        //  Clear cache logs
                        _LogsCache.Clear();
                    }
                    catch (Exception e)
                    {
                        AddLog("The output got some error. Type: " + e.GetType() + ", Message: " + e.Message,
                            "Logger::WriteRTFCacheLogs()", LogType.Debug);

                        _OutputSetting = LoggerOutputSetting.NotWriteToFileRTF;
                        AddLog("Change the output setting to \"NotWriteToFileRTF\".", "Logger::WriteRTFCacheLogs()", LogType.Debug);

                        //  Close the Thread
                        if (timer != null)
                            timer.Dispose();
                        timerDelegate = null;

                        AddLog("Close the output Thread.", "Logger::WriteRTFCacheLogs()", LogType.Debug);

                        throw;
                    }
                }
            }
        }
开发者ID:billmoling,项目名称:Core,代码行数:60,代码来源:Logger.cs

示例13: savefilertf

 private void savefilertf(string p, RichTextBox invao)
 {
     try
     {
         invao.SaveFile(p, RichTextBoxStreamType.PlainText);
         //MessageBox.Show("save OK");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
开发者ID:tranquangchau,项目名称:cshap-2008-2013,代码行数:12,代码来源:Form1.cs

示例14: SqlConnection

        void 中译英入题目表()
        {
            SqlConnection conn = new SqlConnection(login.sqlName);
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "new_教师英语单词_中译英";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("timuWenBen", SqlDbType.VarChar).Value = textBox2.Text.Trim()+textBox1.Text.Trim();
            cmd.Parameters.Add("teacherName", SqlDbType.NVarChar).Value = login.teacherName;
            //cmd.Parameters.Add("wentiYinPin", SqlDbType.NVarChar).Value = "无";
            cmd.Parameters.Add("danciID", SqlDbType.NVarChar).Value = wordID;
            cmd.Parameters.Add("zhongYiyingID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();
            id中译英 = (int)cmd.Parameters["zhongYiyingID"].Value;
            conn.Dispose();
            cmd.Dispose();

            RichTextBox rtbQ = new RichTextBox();
            rtbQ.Text = textBox2.Text + "\n";
            rtbQ.SelectAll();
            rtbQ.SelectionFont = new Font("微软雅黑", 35);
            rtbQ.SaveFile(login.qfold + id中译英, RichTextBoxStreamType.RichText);

            RichTextBox rtbA = new RichTextBox();
            rtbA.Font = new Font("微软雅黑", 45);
            rtbA.ForeColor = Color.Red;
            rtbA.Text = textBox1.Text;

            RichTextBox rtbYinBiao = new RichTextBox();
            rtbYinBiao.Font = new Font("Lucida Sans Unicode", 20);
            rtbYinBiao.ForeColor = Color.Gray;
            rtbYinBiao.Text = textBox7.Text + "\n";

            RichTextBox eg1Eng = new RichTextBox();
            eg1Eng.Font = new Font("微软雅黑", 20);
            eg1Eng.Text = textBox3.Text;

            RichTextBox eg1Ch = new RichTextBox();
            eg1Ch.Font = new Font("楷体", 15);
            eg1Ch.ForeColor = Color.Gray;
            eg1Ch.Text = textBox4.Text + "\n";

            RichTextBox eg2Eng = new RichTextBox();
            eg2Eng.Font = new Font("微软雅黑", 20);
            eg2Eng.Text = textBox5.Text;

            RichTextBox eg2Ch = new RichTextBox();
            eg2Ch.Font = new Font("楷体", 15);
            eg2Ch.ForeColor = Color.Gray;
            eg2Ch.Text = textBox6.Text ;

            RichTextBox rtbZong = new RichTextBox();
            rtbZong.SelectedRtf = rtbQ.Rtf;
            rtbZong.SelectedRtf = rtbA.Rtf;
            rtbZong.SelectedRtf = rtbYinBiao.Rtf;
            rtbZong.SelectedRtf = eg1Eng.Rtf;
            rtbZong.SelectedRtf = eg1Ch.Rtf;
            rtbZong.SelectedRtf = eg2Eng.Rtf;
            rtbZong.SelectedRtf = eg2Ch.Rtf;

            rtbZong.SaveFile(login.afold + id中译英, RichTextBoxStreamType.RichText);
        }
开发者ID:hank87,项目名称:testTeacher,代码行数:62,代码来源:英语单词.cs

示例15: downloadChangeLog

        public static void downloadChangeLog(bool calledFromConfig)
        {
            // sort the list of patches with the newest first, this correctly display the change log
            updateCheck.patchList.Sort(delegate(updateCheck.patches p1, updateCheck.patches p2) { return p2.patchVersion.CompareTo(p1.patchVersion); });

            RichTextBox richTextBoxInput = new RichTextBox();
            RichTextBox richTextBoxOutput = new RichTextBox();
            //
            // Download the change logs
            //
            foreach (updateCheck.patches thePatch in updateCheck.patchList)
            {
                if (thePatch.patchChangeLog.StartsWith("C:\\"))
                {
                    System.IO.File.Copy(thePatch.patchChangeLog, Path.Combine(Path.GetTempPath(), "ChangeLog.rtf"), true);
                    return;
                }

                WebClient client = new WebClient();
                try
                {
                    client.DownloadFile(thePatch.patchChangeLog, Path.Combine(Path.GetTempPath(), "ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf"));
                }
                catch (Exception e)
                {
                    if (calledFromConfig)
                        MessageBox.Show("Unable to access ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf\n\n" + e.Message, "ChangeLog access issue");

                    //smcLog.WriteLog("Unable to access ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf > " + e.Message, LogLevel.Error);
                    return;
                }
               // smcLog.WriteLog("Downloaded File : " + Path.Combine(Path.GetTempPath(), "ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf"), LogLevel.Info);
            }
            //
            // And combine them into a single change log
            //
            if (File.Exists(Path.Combine(Path.GetTempPath(), "ChangeLog.rtf")))
                File.Delete(Path.Combine(Path.GetTempPath(), "ChangeLog.rtf"));

            //smcLog.WriteLog("Processing Change Log...", LogLevel.Info);

            try
            {
                // Add each file and save as ChangeLog.rtf
                int patchCnt = 1;
                AvalonGUIConfig.theRevisions = "Patch: ";
                foreach (updateCheck.patches thePatch in updateCheck.patchList)
                {
                    richTextBoxInput.LoadFile(Path.Combine(Path.GetTempPath(), "ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf"));
                    richTextBoxInput.SelectAll();
                    richTextBoxInput.Copy();
                    richTextBoxOutput.Paste();
                    System.IO.File.Delete(Path.Combine(Path.GetTempPath(), "ChangeLog-" + thePatch.patchVersion.MinorRevision.ToString() + ".rtf"));
                    if (patchCnt < updateCheck.patchList.Count)
                        AvalonGUIConfig.theRevisions = AvalonGUIConfig.theRevisions + thePatch.patchVersion.ToString() + " / ";
                    else
                        AvalonGUIConfig.theRevisions = AvalonGUIConfig.theRevisions + thePatch.patchVersion.ToString();
                    patchCnt++;
                }
                richTextBoxOutput.SaveFile(Path.Combine(Path.GetTempPath(), "ChangeLog.rtf"));
                richTextBoxInput.Dispose();
                richTextBoxOutput.Dispose();
            }
            catch (Exception ex)
            {
               Log.Error("Exception Reading Change Logs: " + ex.Message + "\\n" + ex.StackTrace);
            }
        }
开发者ID:ncoH,项目名称:Avalon,代码行数:68,代码来源:updateFound.cs


注:本文中的System.Windows.Forms.RichTextBox.SaveFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。