日期:2014-05-19  浏览次数:21161 次

如何为RichTextBox多个不同行设置不同的字体和颜色
小弟不才,请教弱智问题:如何为RichTextBox多个不同行设置不同的字体和颜色?
我想为每次新增加的文本设置字体的颜色,可是,下次新增文本时,原来那些被设置过字体和颜色的文字又变成了默认的字体和颜色,只有最后一次的设置才有效果,我的代码如下。

int   startIndex   =   this.receiveBox.Text.Length;
//   message是接收到的字符串.
this.receiveBox.Text   +=   message   +   Environment.NewLine;
this.receiveBox.Select(startIndex,   message.Length);
this.receiveBox.SelectionColor   =   Color.Blue;
this.receiveBox.SelectionFont   =   new   Font( "Arial ",   12);

望好心人指教,多谢多谢!


------解决方案--------------------
this.receiveBox.AppendText(message + Environment.NewLine);