Saving BackgroundImage

I was fiddling around with the “Demo1” application and I wanted to include the backgroundImage path to the GoView when I hit save. When I Open the file again the backgroundImage isn’t populated. Any suggestions on how to do this?


Control.BackgroundImage is of type Image, which is not serializable. You’ll need to get the Image and set the property yourself.

But please note that Demo1 uses binary serialization for convenience. We strongly recommend against using binary serialization for persisting your diagrams. You can read more about this issue in the User Guide.

I had created an Property on the GoView “ImagePath”. when the Doc is saved, the DocView is not. Is this as expected? and GoView is not Serializable. Do I need to go about this a different way or is there functionality built in that i should be using?

You could add that property to the GoDocument-inheriting class. I assume it’s a string or the equivalent.

That's right -- GoView is not serializable. Neither are other System.Windows.Forms.Controls.
Most of the samples that do persist documents do so using XML. But you can do whatever your application requires.