将richtextbox内容保存为字节数组Byte[]
//使用内存流
using (MemoryStream savefilestream = new MemoryStream())
{
richTextBox1.SaveFile(savefilestream, RichTextBoxStreamType.RichText);
Byte[] bt = savefilestream.ToArray();
}
将richtextbox读取字节数组Byte[]
//从数据库中读出Byte[]
Byte[] bt = (Byte[])rd[0];
//MessageBox.Show(bt.Length.ToString());
MemoryStream fm = new MemoryStream(bt);
richTextBox1.LoadFile(fm, RichTextBoxStreamType.RichText);
fm.Close();