|
-
Jun 8th, 2006, 09:40 PM
#1
Thread Starter
Frenzied Member
why is the graphics pen object is not serializable ??? anyone knows why ?
Dear all,
i have been using binary serialzer to serialize some graphics objects and images into one file so that i can save and load them later into use inside my simple software.
all images, fonts , color variables inside my class (which is declared as <serializable> by the way ) is serialized successfully. when i add a pen object to the class i get an error ?
here is the error
-----------------------------------------------------------------------
System.Runtime.Serialization.SerializationException: The type System.Drawing.Pen in Assembly System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type, Boolean excludeNonSerializable)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at SoftexTravelControl.FrmHotelFlyers.Button14_Click(Object sender, EventArgs e) in E:\travelmdl.mdl
------------------------------------------------------------------------
what is this error ??
thank you in advance
rgds
Maged A. Reda
-
Jun 8th, 2006, 09:52 PM
#2
Re: why is the graphics pen object is not serializable ??? anyone knows why ?
The type System.Drawing.Pen ... is not marked as serializable.
To be serialisable a type must be decorated with the Serializable attribute.
-
Jun 9th, 2006, 12:02 AM
#3
Thread Starter
Frenzied Member
Re: why is the graphics pen object is not serializable ??? anyone knows why ?
yes i have read the error. and i understand it of course
i am asking if the pen type is always unserilizable and if there is anything that i can do about to include it in my serialization process.
please note that i am talking the pen type and not my class, my class is marked as <serializable> and it accepts serialization when it doesnt contain a pen variable
is there anything that i can do to work around this issue.
also i remarked in the error this :
The type System.Drawing.Pen in Assembly System.Drawing, Version=1.0.5000.0,
is there any other versions of framework that are serializable ???
thx for your time jmcilhinney
-
Jun 9th, 2006, 06:34 AM
#4
Re: why is the graphics pen object is not serializable ??? anyone knows why ?
It appears that several graphics objects are nonserialisable.
However, you can always use GDI+'s metafile support to store complex vector graphics. see MSDN.
I don't live here any more.
-
Jun 10th, 2006, 02:20 AM
#5
Thread Starter
Frenzied Member
Re: why is the graphics pen object is not serializable ??? anyone knows why ?
why cant i inherits from the pen class and mark my new class type as serializable ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|