WinForm RichTextBox 加载大量文本卡死和UTF-8乱码问题
在RichTextBox控件的使用中我们会遇到加载TXT文件的问题,通常我们会有两种处理方式。
一、加载TXT字符串,设置到RichTextBox
//打开并且读取文件数据
FileStream fs = new FileStream(txtPath, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs, Encoding.UTF8);
//读取到的所有文本字符串
string str = sr.ReadToEnd();
//将读取到的文本赋值到richTextBox中
richTextBox.Text.....
Spring/p/17585574.html" rel="nofollow" target="_blank" style="font-size: 16px;background-color: rgb(24, 144, 255); color: white;padding: 8px;padding-left: 30px;padding-right: 30px;border-radius: 2rem;">阅读原文
暂无评论...