开发者

Saving(storing) a TabPage

Microsoft Visual C# 2010 Express

I've been looking all day for a way to somehow save a TabPage containing runtime-added images and controls (the user can move them in the TabPage) so that they can be used later. I tried using serialization but it seams that you can't serialize interfaces. I'm using a SqlCe database but I couldn't find a way to store it there either.

Can someone please point me in the right direction? Thanks in advance.

[Later edit] Thank you for your answers. I've managed to do it following your advice, saving each controller's proprieties into the database. Basically, I'm not saving th开发者_开发知识库e controller, I'm recreating it every time I need it. It's a little messy but it solves my problem.


If you want to save in a database you need to create a table where to store all the information needed to restore the state of the interface.

Most likely, you will need to store some key data for each image you save: Position, Size, Image source (possibly a file name or another resource), etc, depending on your needs.

You don't get a ready to use solution for that.


As Adi said, you have to do that manually by saving the key properties in database, have a look at Create And Host Custom Designers With The .NET Framework 2.0. It will help you with using the Visual Studio designer itself.

Note, you can download a sample of the designer and the source code exists as well.

Good luck!


Thank you for your answers. I've managed to do it following your advice, saving each controller's proprieties into the database. Basically, I'm not saving the controller, I'm recreating it every time I need it. It's a little messy but it solves my problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜