WPF RichTextBox设置文本颜色

时间:2015-07-20 19:19:24   收藏:0   阅读:918
//追加
txtResult.Document.Blocks.Add(new Paragraph(new Run("add by run") { Foreground = Brushes.Blue }));

//替换
txtResult.Selection.Text = "add by selection";               
txtResult.Selection.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);

 

原文:http://www.cnblogs.com/dajianshi/p/4662125.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!