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


C# RichTextBox.AppendText方法代码示例

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


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

示例1: Question

        public Question(string myFilename, RichTextBox richMain)
        {
            Filename = Path.GetFileName(myFilename);
            string xmlText = File.ReadAllText(myFilename);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xmlText);

            try
            {
                XmlNode xmlQD = xmlDoc.GetElementsByTagName("QuestionDesc")[0];
                XmlNode xmlQ = xmlDoc.GetElementsByTagName("QuestionText")[0];
                XmlCDataSection xmlCData = xmlQ.FirstChild as XmlCDataSection;
                XmlNode xmlAA = xmlDoc.GetElementsByTagName("AnswerA")[0];
                XmlNode xmlAB = xmlDoc.GetElementsByTagName("AnswerB")[0];
                XmlNode xmlAC = xmlDoc.GetElementsByTagName("AnswerC")[0];
                XmlNode xmlAD = xmlDoc.GetElementsByTagName("AnswerD")[0];
                XmlNode xmlT = xmlDoc.GetElementsByTagName("Time")[0];
                XmlNode xmlL = xmlDoc.GetElementsByTagName("Level")[0];
                XmlNode xmlA = xmlDoc.GetElementsByTagName("Correct")[0];

                QuestionDescripion = xmlQD.InnerText.ToString();
                QuestionText = xmlCData.InnerText;
                AnswerA = xmlAA.InnerText;
                AnswerB = xmlAB.InnerText;
                AnswerC = xmlAC.InnerText;
                AnswerD = xmlAD.InnerText;
                Correct = xmlA.InnerText;
                Time = Convert.ToInt32(xmlT.InnerText);
                Level = Convert.ToInt32(xmlL.InnerText);
            }
            catch (Exception expError)
            {
                richMain.AppendText("Problem with question file format: " + expError.Message + Environment.NewLine);
            }
        }
开发者ID:nccgroup,项目名称:44Con2013Game,代码行数:35,代码来源:Question.cs

示例2: ChangeTextProperly

 //for system messages
 private void ChangeTextProperly(RichTextBox rtb, string msg)
 {
     if (rtb.Dispatcher.CheckAccess())
     {
         rtb.AppendText(msg + "\n");
         return;
     }
     else
     {
         rtb.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new TextChanger(delegate() { this.ChangeTextProperly(rtb, msg); }));
     }
 }
开发者ID:Apocalipsyz,项目名称:Lithium,代码行数:13,代码来源:TextManager.cs

示例3: logWithTime

 public void logWithTime(string s, RichTextBox rtb)
 {
     DateTime DTN = DateTime.Now;
     string LogDateTime = DateTime.SpecifyKind(DTN, DateTimeKind.Local).ToString();
     try
     {
         rtb.AppendText(LogDateTime + ": " + s + "\r\n");
         rtb.ScrollToEnd();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
开发者ID:keyanmca,项目名称:Live-Streamer-Plus,代码行数:14,代码来源:Log.cs

示例4: CreateNodeDialog

        Window CreateNodeDialog(out RichTextBox richBox) {
            var window = new Window {Width = 200, Height = 200};
            var mp = Mouse.GetPosition(_dockPanel);
            window.Left = mp.X;
            window.Top = mp.Y;
            var panel = new DockPanel();

            window.Content = panel;

            var textBox = new TextBox {Text = "Please modify the node label:"};

            DockPanel.SetDock(textBox, Dock.Top);
            panel.Children.Add(textBox);

            richBox = new RichTextBox();
            richBox.FontSize *= 1.5;
            richBox.AppendText("Label");
            richBox.FontFamily = new FontFamily("Consoles");
            richBox.Width = window.Width;
            DockPanel.SetDock(richBox, Dock.Top);
            panel.Children.Add(richBox);
            panel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            panel.Width = textBox.Width;
            var button = new Button {Content = "OK"};
            button.Click += (a, b) => window.Close();
            DockPanel.SetDock(button, Dock.Bottom);
            button.IsDefault = true;
            button.Width = 40;
            button.Height = 40;
            panel.Children.Add(button);
            panel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            window.SizeToContent = SizeToContent.WidthAndHeight;
            return window;
        }
开发者ID:WenzCao,项目名称:automatic-graph-layout,代码行数:34,代码来源:App.cs

示例5: logWithoutTime

 public void logWithoutTime(string s, RichTextBox rtb)
 {
     rtb.AppendText(s + "\r\n");
     rtb.ScrollToEnd();
 }
开发者ID:keyanmca,项目名称:Live-Streamer-Plus,代码行数:5,代码来源:Log.cs

示例6: cm_addLexemToRichText

 //private void cm_showGram(cParserException _ex)
 //{
 //    f_rtbGram.Document.Blocks.Clear();
 //    foreach (cToken _token in _ex.cf_Tokens)
 //    {
 //        switch (_token.cf_Type)
 //        {
 //            case eTokenType.перевод_строки:
 //                f_rtbGram.AppendText(Environment.NewLine);
 //                break;
 //            case eTokenType.стрелка:
 //                f_rtbGram.AppendText(" -> ");
 //                break;
 //            case eTokenType.Null:
 //                f_rtbGram.AppendText(" -> ");
 //                break;
 //            default:
 //                cm_addLexemToRichText(_token.cf_Value as cLexem, f_rtbGram);
 //                break;
 //        }
 //    }
 //}
 private void cm_addLexemToRichText(cLexem a_lexem, RichTextBox a_rtb)
 {
     if (a_lexem.cp_Type == eLexType.NonTerminal)
         a_rtb.AppendText("<");
     else if (a_lexem.cp_Type == eLexType.Action)
         a_rtb.AppendText("{");
     //a_rtb.SelectionFont = new Font(a_rtb.SelectionFont, FontStyle.Bold);
     //a_rtb.AppendText(a_lexem.ToString());
     TextRange _tr = new TextRange(a_rtb.Document.ContentEnd,a_rtb.Document.ContentEnd);
     _tr.Text = a_lexem.ToString();
     _tr.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
     _tr = new TextRange(a_rtb.Document.ContentEnd, a_rtb.Document.ContentEnd);
     _tr.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Regular);
     //a_rtb.SelectionFont = new Font(a_rtb.SelectionFont, FontStyle.Regular);
     if (a_lexem.cp_Type == eLexType.NonTerminal)
         a_rtb.AppendText(">");
     else if (a_lexem.cp_Type == eLexType.Action)
         a_rtb.AppendText("}");
     a_rtb.AppendText(" ");
 }
开发者ID:PaveLiArcH,项目名称:LR1TableGenerator,代码行数:42,代码来源:fwMain.xaml.cs

示例7: show_info

 //---------------------------------------------------------------------------------------------------------
 //do wyswietlania informacji dla bierzacego uzytkownika o jego stanie
 public void show_info(RichTextBox info, string tekst_info)
 {
     info.AppendText(tekst_info);
     log_info.ScrollToEnd();
 }
开发者ID:AdrianPawelczyk,项目名称:projekt_C-_ojp2,代码行数:7,代码来源:MainWindow.xaml.cs

示例8: LoadQuestions

        // Loads the XML questions from this directory
        public bool LoadQuestions(string strDirectory, RichTextBox richMain)
        {
            if (Directory.Exists(strDirectory) == false)
            {
                System.Windows.MessageBox.Show("Couldn't find the directory containing questions: " + strDirectory, "Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                return false;
            }

            int intCount = 0;
            foreach(string strFile in Directory.EnumerateFiles(strDirectory,"*.xml")){

                XDocument thisXML = XDocument.Load(strFile);
                Question thisQuestion = new Question(strFile,richMain);
                lstQuestions.Add(thisQuestion);
                intCount++;
            }

            richMain.AppendText("Loaded a total of " + lstQuestions.Count() + " files" + Environment.NewLine);
            Count = lstQuestions.Count();

            return true;
        }
开发者ID:nccgroup,项目名称:44Con2013Game,代码行数:23,代码来源:QuestionCollection.cs

示例9: asyncOutputBoxAppendNoBreak

 private void asyncOutputBoxAppendNoBreak(RichTextBox targetBox, string text)
 {
     targetBox.Dispatcher.Invoke(new Action(() => targetBox.AppendText(text)));
 }
开发者ID:TheQuack45,项目名称:HypeBotCSharp-old,代码行数:4,代码来源:MainWindow.xaml.cs

示例10: show_results_Click

 // displays the results
 private void show_results_Click(object sender, RoutedEventArgs e)
 {
     if (testSuitname.Text == "")
     {
         MessageBox.Show("Please provide Test Suite Name");
         return;
     }
     logfilespath.Document.Blocks.Clear() ;
     String filename = "";
     filename = cc.GetLogFile(testSuitname.Text, username.Text, "detailedResults.log");
     //MessageBox.Show(filename);
     RichTextBox rctxtBx = new RichTextBox();
     rctxtBx.Height = 250;
     rctxtBx.Width = 400;
     rctxtBx.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
     Paragraph p = rctxtBx.Document.Blocks.FirstBlock as Paragraph;
     p.Margin = new Thickness(0);
     p.LineHeight = 10;
     fetchResultGrid.Children.Add(rctxtBx);
        filename = cc.GetLogFile(testSuitname.Text,username.Text, "results.xml");
        //MessageBox.Show(filename);
        if (filename == null || !filename.Contains("xml"))
        {
            MessageBox.Show("File Not Found. Pleasey try after some time or run the tests suite again.");
            return;
        }
       // MessageBox.Show(filename);
        TextReader tr = new StreamReader("Test Results\\" +testSuitname.Text + "_" + "results.xml");
        StringBuilder sb = new StringBuilder();
        sb.Append(tr.ReadToEnd());
        string tempStr = sb.ToString();
        sb.Replace("><",">\n<");
        rctxtBx.AppendText(sb.ToString());
        tr.Close();
        DirectoryInfo d = Directory.CreateDirectory("Test Results");
        String logFilesPath = System.IO.Path.GetFullPath("Test Results\\" +testSuitname.Text + "_" + "results.xml");
        logfilespath.AppendText(logFilesPath);
        logfilespath.AppendText("\n");
        logFilesPath = System.IO.Path.GetFullPath("Test Results\\" + testSuitname.Text + "_" + "detailedResults.log");
        logfilespath.AppendText(logFilesPath);
 }
开发者ID:himanshugpt,项目名称:TestHarness,代码行数:42,代码来源:MainWindow.xaml.cs


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