Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建 RichTextBox 并得到以下代码:
richTextBox1.SelectionFont = new Font("Verdana", 10, FontStyle.Regular); richTextBox1.SelectionColor = Color.Blue; richTextBox1.Text += "ddddd";
文字保持不变。我注意到richTextBox1.Text 将我的字体改回了默认字体。我该如何解决?
尝试使用 AppendText 方法:
richTextBox1.SelectionFont = new Font("Verdana", 10, FontStyle.Regular); richTextBox1.SelectionColor = Color.Blue; richTextBox1.AppendText("ddddd"); richTextBox1.SelectionFont = myDefaultFont; richTextBox1.SelectionColor = myDefaultColor;