要设置WinForm RichTextBox的字体和颜色,可以使用以下代码示例:
// 设置字体richTextBox1.SelectionFont = new Font("Arial", 12, FontStyle.Bold);// 设置文字颜色richTextBox1.SelectionColor = Color.Red;在上面的示例中,首先使用SelectionFont属性设置RichTextBox中选定文本的字体,可以指定字体名称、大小和样式。然后使用SelectionColor属性设置选定文本的颜色。
另外,如果要设置整个RichTextBox的默认字体和颜色,可以在RichTextBox的属性窗口中设置Font和ForeColor属性。


