0
我想要第二行,更改为其他颜色。更改Richtextbox中一行的颜色
我的代码如下:
private void WindowLoaded(object sender, RoutedEventArgs e)
{
UpdateRTBOnDifferentThread("stackoverflow.com" + Environment.NewLine+"stackoverflow.org" + Environment.NewLine);
}
private void UpdateRTBOnDifferentThread(string message)
{
Dispatcher.Invoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate
{
var newExternalParagraph = new Paragraph(new Run(message)) {Foreground = Brushes.Black};
richTextBox1.Document.Blocks.Add(newExternalParagraph);
return null;
}), null);
}
的下联是:“stackoverflow.org”
我想改变颜色后,输入文字
请给我看看正确的方法 – mrJack