C#读取和保存文本文件时如何保持字体大小
正在用c#做记事本的功能,但读取和保存文件时总是不能保持修改后的字体大小。请教高手,有什么方法?以下是我的读取和保存的代码:
------------------------------------------------------
private void fileOpen_Click(object sender, EventArgs e)
{
SaveFileDialog filedlg = new SaveFileDialog();
filedlg.Filter = "Text Document(*.txt)|*.txt|All Files(*.*)|*.* ";
filedlg.Title = "打开文件 ";
filedlg.ValidateNames = true;
try
{
if (filedlg.ShowDialog() == DialogResult.OK)
{
//StreamReader sr = new StreamReader(filedlg.FileName,System.Text.Encoding.Default);
FileStream fs = new FileStream(filedlg.FileName,FileMode.OpenOrCreate,FileAccess.ReadWrite);
StreamReader sr = new StreamReader(fs);
ArrayList buffer = new ArrayList();
//从文件中读取内容并赋给显示文件内容对象框
while (sr.Peek() != -1)
{
buffer.Add(sr.ReadLine()); //一次读取一行数据
}
newForm child2 = new newForm();