The Wagner Blog
Development Notes, News and Trivia









Subscribe to "The Wagner Blog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.
 

 

Friday, March 14, 2003
 

I think I'll just outright quote the entire entry by Andy Smith.

I don't make very many winforms apps in my free time, but for those who are making them, I have a little assembly that you may be interested in.

It started when a user wanted the application to remember where he placed the form and how big it was between starts of the app. A pretty reasonable request, I thought.

I figured, I'd just create a state persistence component that I drop on the base form class that all my app's forms derive from, and it'll be done. I figured that this component has probably already been written somewhere.

What I found is that there weren't any that didn't require ( at least ) some code to be written to get it to work. I wasn't happy with that, so I figured I'd just write my own.

I started off just writing a component, but found that the Component class doesn't have a way of automaticly knowing about the form it has been dragged onto. This makes sense, as most components have nothing to do with forms. I figured I could use Control, but I wanted to keep my component non-visual, and living in the component tray in vstudio. What I wanted was a mid-level object between Component and Control. Unfortunately, no such class exists. So I created one.

Say hello to FormComponent. When dragged onto a windows form, it overrides the normal InitializeComponent code-serialization process and adds a line of code which sets the current form as the component's Form property. Once this piece of magic is in place, components that want to access the current form don't have to rely on the developer to write code hooking them up.

So now writing the state persister is trivial. I simply subscribe to some key events, Load, Resize, Move, and Closing, to load, track, and save the state of the form to xml in the user's app data folder.

anyway, enough jabbering, here's the link to the form state persister and base FormComponent class, for easy creation of similar form-oriented components. In the download is the full solution source code in C#, a precompiled version for those who just want to use it, and an example application with 1 form that persists its state.

I hope yall like it, have fun.

http://dotnetweblogs.com/asmith/posts/3799.aspx


11:57:38 PM    

I'm enjoying the fact that people are posting lots of small sets of links of related material. Hope the links don't get stale. Here is another find:

MSDN is a vast resource, and as such finding specific information on Security is sometimes an exercise in patience. In short, I can't ever find these darn articles when I am looking for them, so here are direct links to them:

.NET Security

[Mobile Musings by Anil John]


11:49:40 PM    

Another Object To Database mapping tool. ORM.NET


11:42:20 PM    


Click here to visit the Radio UserLand website. © Copyright 2004 Thomas Wagner.
Last update: 5/2/2004; 4:46:04 PM.
This theme is based on the SoundWaves (blue) Manila theme.
March 2003
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Jan   Apr