|
-
August 5th, 2007, 11:57 PM
#1
serialize a graphicspath
Hi,
I want to save a few arraylist into a file. One method that i found out is to use serializable. However, below is the exception error when i try to save the window form.
Additional information: The type System.Drawing.Drawing2D.GraphicsPath in Assembly System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken.... is not marked as serializable.
The program is able to draw shapes into a panel and it has shape classes(e.g. rect class,polygon class...) in those classes it uses graphicspath to add the shapes onto the panel. besides that, one of the arraylist also contains Graphicspath. I'm able to serialize the arraylist other than those that use GraphicsPath. So, can anybody help me to explain what i should do to solve this problem?
Thanks in advance to anybody who is willing to lend a helping hand
-
August 6th, 2007, 10:07 PM
#2
Re: serialize a graphicspath
You can use BinaryFormatter and adapter class derived from SerializableAdapter class to workaround that. Have a look at the second post from the last for an example on how to do this.
In short, you can write your own data container for the information you need to be serialize from graphicsPath (you'd probably only need the point array and pathtype array) and have this class container marked as serializable, you don't need to save the entire graphicspath class since it would be a waste.
-
August 7th, 2007, 02:34 PM
#3
Re: serialize a graphicspath
Is this the same problem as the thread deserialisation problem or have you solved serialisation and omnly need deserializing now. In both cases post your code or better the needed part as a small demoproject so I see your needs and can help you
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
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
|