小弟想请教一下哈。看 msdn把头都看大了。
我做的是一个小小的写字板程序,我现在完成的程序可以可以保存文本文件但是却不能保存该文本文件中的有关字体的信息如字体,字体颜色阿什么的,不知道怎样把richtextBox中字体,以及字体颜色的信息保存到文件中。请高人指点一下有关的    类,和成员方法。顺便请教一下如何把自己完成的程序作成一个安装文件包。请高人指点一下相关的ms的类和成员方法。
谢谢

解决方案 »

  1.   

    ref:
    http://www.codeproject.com/cs/miscctrl/csexrichtextbox.asp
      

  2.   

    public static byte[] SerializeObject(object pObj)
    {
    if(pObj == null)
    return null;
    System.IO.MemoryStream _memory = new System.IO.MemoryStream();
    BinaryFormatter formatter = new BinaryFormatter();
    formatter.Serialize(_memory,pObj);
    _memory.Position = 0;
    byte[] read = new byte[_memory.Length];
    _memory.Read(read,0,read.Length);
    _memory.Close();
    return read;
    }
    public static object DeserializeObject(byte[] pBytes)
    {
    object _newOjb = null;
    if(pBytes == null)
    return _newOjb;
    System.IO.MemoryStream _memory = new System.IO.MemoryStream(pBytes);
    _memory.Position = 0;//_memory.Capacity=128;
    BinaryFormatter formatter = new BinaryFormatter();
    _newOjb = formatter.Deserialize(_memory);
    _memory.Close();
    return _newOjb;
    }
      

  3.   

    保存成rtf文件不就得了吗?
    richtextbox.savefile("d:\1.txt",vbrtf)