Is it possible to store controls(Panel) as object, serialize it and store it as a file?

Posted by ikky on Stack Overflow See other posts from Stack Overflow or by ikky
Published on 2010-03-31T07:26:54Z Indexed on 2010/03/31 9:13 UTC
Read the original article Hit count: 387

The topic says it all.

Using Compact Framework C#

I'm tiling (order/sequence is important) some images that i download from an url, into a Panel(each image is a PictureBox). This can be a huge process, and may take some time.

Therefor i only want the user to download the images and tile them once. So the next time the user uses the Tile Application, the Panel that was created the first time is already stored in a file and is loaded from that file.

So what i want is a method to store a Panel as a file.

Is this possible, or do you think i should do it another way?

I've tried something like this:

            BinaryWriter panelStorage = new BinaryWriter(new FileStream("imagePanel.panel", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None));
            Byte[] bImageObject = new Byte[20000];
            bImageObject = (byte[])(object)this.imagePanel;
            panelStorage .Write(bMapObject);
            panelStorage .Close();

But the casting was not very legal :P

"InvalidCastException"

Can anyone help me with this problem?

Thank you in advance!

© Stack Overflow or respective owner

Related posts about c#

Related posts about compact-framework