开发者

C# LoadFile font and formatting

开发者 https://www.devze.com 2023-03-16 22:04 出处:网络
How can I load a file in a c# app so that I can see it formatted. If I use: richTextBox2.LoadFile(\"a.txt\", RichTextBoxStreamType.PlainText);

How can I load a file in a c# app so that I can see it formatted.

If I use:

richTextBox2.LoadFile("a.txt", RichTextBoxStreamType.PlainText);

I did it with:

开发者_JAVA百科
textBox2.Text = File.ReadAllText("a.txt");

The text is not formatted at all, new lines and CR's are totally missing, also the tabs

also the file open ok in notepad, but it opens bad in wordpad

Can I load the file in a textbox? (use multi-line)


Have you tried loading it as RichText?

richTextBox2.LoadFile("a.rtf", RichTextBoxStreamType.RichText);
0

精彩评论

暂无评论...
验证码 换一张
取 消