替换RichTextBox中的文本并保持格式化 [英] Replace text in RichTextBox eith keep formatting
本文介绍了替换RichTextBox中的文本并保持格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi Group
如何用保留替换的文本格式替换WPF RichTextBox中的文本?
Hi Group
how can i replace text in WPF RichTextBox with keep replaced text formatting??
推荐答案
RTB.SelectAll();
string[] textArray = RTB.SelectedText.Split(new char[] { '\n' });
foreach (string strText in textArray)
{
if (!string.IsNullOrEmpty(strText))
RTB.Rtf = RTB.Rtf.Replace(strText, strText.ToUpper());
}
这篇关于替换RichTextBox中的文本并保持格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文