Serializing System.Windows.Forms

G

Guest

I am working on a form designer. I have defined my own controls to list into
a IToolBoxService, and the PropertyGrid, but I am having a difficult time
Serializing a Windows Form to XML.

Bascially, I want to take the form & Properties, and Controls within the
form & Properties and place them into an XML file for later use.

The ResXResourceWriter is fairly straight forward to use, but as a resx
files, it doesn't store all of the property information about the form.
System.Windows.Forms.Form is not serializable, so what options do I have to
serialize this stuff to xml?

Any examples, or help is greatly appreciated.
 
G

Guest

Yea, I saw that, but I'm assuming since there isn't a ton of information out
there, that I need to write my own serialization for a form, and the controls
it contains. It isn't that difficult really, but I would have thought that
this was built into the framework.

Thanks,
LJC
 
A

Alexander Shirshov

Lucas,

Just popped up in my memory:
http://www.divil.co.uk/net/articles/designers/hosting.asp. It might be
useful to you, but I'm quite sure you've read it already.

Few months ago I spent several hours on myxaml web site and it appeared as
the place to look for combined wisdom on XML (de)serialization of CLR object
graphs. There were thoughtful discussions on the subject in Marc's articles
and in the forums. I can't think of better resource and trust me, I surf a
lot: I'm unemployed for many months. :)

Out of curiousity, why are you writing your own form designer? Is it
something domain specific?

Alexander
 
B

Bob Powell [MVP]

Windows Forms objects are a pain to serialize so most often this task is
accomplished using an implementation of the Memento Pattern.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top