我正在为tabControl&创建一个新选项卡。里面有一个richtextbox。
但是现在我想在richtextbox中添加新文本,但我不知道该怎么做。 (通过另一个事件,即)。
这是我当前尝试使用AppendText的代码:
RichTextBox achievementlog = new RichTextBox();
achievementlog.AppendText("stackoverflow");
这是我添加tab和richtextbox的代码,如果有帮助的话
//// Create the tab page:
tabPage = new TabPage();
tabPage.Name = "Achievements!";
tabPage.Text = "Achievements!";
tabPage.BackColor = System.Drawing.Color.White;
RichTextBox achievementlog = new RichTextBox();
//properties of richtextbox
achievementlog.Text = "Achievements earned:\n-----------------------------\n\n";
achievementlog.Location = new Point(20, 20);
achievementlog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(127)))), ((int)(((byte)(39)))));
achievementlog.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
achievementlog.ForeColor = Color.White;
achievementlog.Width = 485;
achievementlog.Height = 200;
achievementlog.ReadOnly = true;
//// Add the new tab page:
tabControl1.TabPages.Add(tabPage);
tabPage.Controls.Add(achievementlog);