在原来的字符串中已使用/r/n换行,但字符串在转换到TextBox.Text值时,不知为什么少了/r,因而在保存前要把/n替换成/r/n
string s;
s = richTextBoxOut.Text;
s = s.Replace("/n", "/r/n");
File.WriteAllText("C:/Documents and Settings/Administrator/桌/aa.txt", s, Encoding.Unicode);
string tempS;
tempS = richTextBoxOut.Text.Replace("/n", "/r/n");
File.WriteAllText(C:/Documents and Settings/Administrator/桌/aa.txt", tempS, Encoding.Default);