本文介绍了C#RichTextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,所以我想问一下如何在RichTextBox上加载2个.txt文件?
Hello, so I want to ask how I need to load 2 .txt files on RichTextBox?
推荐答案
private void LoadFiles()
{
LineBreak LinebreakInsert;
Run RunningLine;
Paragraph pMain = new Paragraph();
string File1Content = System.IO.File.ReadAllText("X:\\Hello.txt");
LinebreakInsert = new LineBreak();
RunningLine = new Run(File1Content);
//RunningLine.Foreground = BrushColor
//RunningLine.FontWeight = fWeight
pMain.Inlines.Add(LinebreakInsert);
pMain.Inlines.Add(RunningLine);
pMain.Inlines.Add(LinebreakInsert);
pMain.Inlines.Add(RunningLine);
rtbMain.Document.Blocks.Add(pMain);
rtbMain.ScrollToEnd();
}
这篇关于C#RichTextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!