0

我正在为我的 tabControl 创建一个新选项卡,并在其中创建一个富文本框。

但现在我想将新文本附加到richtextbox,但我不知道该怎么做。(通过另一个事件,即)。

这是我当前尝试向其追加文本的代码:

RichTextBox achievementlog = new RichTextBox();
        achievementlog.AppendText("stackoverflow");

这是我添加标签和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);
4

0 回答 0