提示的异常如下:
程序集“WinDraw, Version=1.2.2.0, Culture=neutral, PublicKeyToken=null”中的类型“WinDraw.DrawView”未标记为可序列化。展开的错误信息: 在 System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   在 System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   在 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   在 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
   在 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
   在 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
   在 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
   在 WinDraw.Core.CommonFunction.CloneObj[T](T RealObject) 位置 E:\分局级解决方案\源码\BranchScene\WinDraw\Core\CommonFunction.cs:行号 680
   在 WinDraw.DrawView.EnterRecognize() 位置 E:\分局级解决方案\源码\BranchScene\WinDraw\DrawViewFunc.cs:行号 6374
   在 WinDraw.DrawView.set_IsRecognitionCurve(Boolean value) 位置 E:\分局级解决方案\源码\BranchScene\WinDraw\DrawViewField.cs:行号 582
   在 WinDraw.MenuLib.RecogAdapter.Method_Slot(Object sender, EventArgs e) 位置 E:\分局级解决方案\源码\BranchScene\WinDraw\MenuLib\RecogAdapter.cs:行号 44
   在 DevComponents.DotNetBar.BaseItem.RaiseClick(eEventSource source)
   在 DevComponents.DotNetBar.BaseItem.InternalMouseUp(MouseEventArgs objArg)
   在 DevComponents.DotNetBar.PopupItem.InternalMouseUp(MouseEventArgs objArg)
   在 DevComponents.DotNetBar.ButtonItem.InternalMouseUp(MouseEventArgs objArg)
   在 DevComponents.DotNetBar.BaseItem.InternalMouseUp(MouseEventArgs objArg)
   在 DevComponents.DotNetBar.ItemContainer.InternalMouseUp(MouseEventArgs objArg)
   在 DevComponents.DotNetBar.ItemControl.OnMouseUp(MouseEventArgs e)
   在 DevComponents.DotNetBar.RibbonBar.OnMouseUp(MouseEventArgs e)
   在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
   在 DevComponents.DotNetBar.ItemControl.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)我仔细查看了一边代码,实在找不到 到底是哪儿 缺少序列化标记了,
另外 DrawView  是个 自定义控件.

解决方案 »

  1.   

    WinDraw.DrawView 没有标记为ISerializable。
      

  2.   


    自定义控件 标记 [Serializable]不可行吧...派生自 UserControl的
      

  3.   


    自定义控件 标记 [Serializable]不可行吧...派生自 UserControl的如果不可行,那么就不该把包含该变量的类型序列化.而是提取出控件中的数据用基础类型保存
      

  4.   


    自定义控件 标记 [Serializable]不可行吧...派生自 UserControl的如果不可行,那么就不该把包含该变量的类型序列化.而是提取出控件中的数据用基础类型保存嗯,我好像找到原因了,在我自定义的类中有一个自定义控件的类型 成员,我单独把那个成员标记为 NonSerialized 的了,不知道 能不能 从根本上解决问题。
      

  5.   

    控件不可已序列化,如果你的自定义类中引用了自定义控件,那将其标记为 NonSerialized,应该是可以的。