自己写了一个随手画的winform 控件,需要对所画的数据进行保存,我想采用二进制序列化进行操作。但是在我点击打开按钮时,却出现了未能加载程序或文件集。以下是我写的代码。敬请高手指点。 private void toolStripButton_Save_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfdlg = new SaveFileDialog();
            sfdlg.Filter = "Point Connector File(*.ptc)|*.ptc| All Files( *.*)|*.*";
            sfdlg.FilterIndex = 1;
        
           Stream strem = null;            if (sfdlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                       
                    strem = File.Open(sfdlg.FileName, FileMode.OpenOrCreate, FileAccess.Write);
                  BinaryFormatter b = new BinaryFormatter();
                  b.Serialize(strem, strokes);                
                          }              catch (Exception excep)
                {
                    MessageBox.Show(excep.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                  if (strem != null)
                   
                 strem.Close();
                 }
                }           
        
        }
                    private void toolStripButton_Open_Click(object sender, EventArgs e)
        {
           OpenFileDialog ofdlg = new OpenFileDialog();
            ofdlg.Filter ="Point Connetor File(*.ptc)|*.ptc|All Files(*.*)|*.*";
            ofdlg.FilterIndex = 1;
        
            Stream  strem=null;
          if (ofdlg.ShowDialog() == DialogResult.OK)
           {
                try
                {
                  
                   strem =File.Open (ofdlg .FileName ,FileMode .Open ,FileAccess .Read );
                    BinaryFormatter b=new BinaryFormatter ();
                    strokes =(Collection<Stroke> )b.Deserialize (strem);
                    this.Invalidate(this.ClientRectangle);
                }
                catch (Exception excep)
               {
                    MessageBox.Show(excep.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
               }
                finally
                {
             
                    if (strem !=null)
                    {strem .Close ();
                    }  
               }           }
          this.Invalidate();
        }
出现的异常为“未能加载文件或程序集,"whiteboard,version=1.0.2436.20196,culture=neutral,publickeytoken=null,或他的一个依赖项,无效指针(异常来自HRESULT:0X80004003(E_POINTER)
请高手们帮帮忙.