![]() |
Desktop Development »
Miscellaneous »
Miscellaneous Controls
Intermediate
IconPanel Custom ControlBy Tom GuintherAn expanding/collapsing 'Task Tray' ala Windows XP and Longhorn |
C#, Windows, .NET 1.0, .NET 1.1VS.NET2003, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
IconPanel is a .NET custom control that displays "tool" items in a expandable/collapsible panel similar to the Notification area of the Taskbar in all recent version of the Microsoft Operating Systems.
The major features of the control are:
Some of the applications that I write need to be highly extensible, allowing components to "plug-in" and "plug-out" as necessary. In addition, screen real-estate can be quite scarce and while our users are domain experts, they are not always technology savy. Using this style of control (perhaps in the status bar of the main application) helps us solve a few basic problems:
Before going into more depth on what the IconPanel control provides and how to use it, it is important to explain the authors overall intentions regarding the implementation and general release of this version of the control so that you can better understand how you might extend it and/or incorporate it into your applications.
While this control is fully functional, fully documented, and fully tested (within the limitations of the demonstration application provided), it is designed using the ME philosophy; it was designed by me, implemented by me, for purposes that are potentially only useful to me, and with Minimal Effort. Within that context I want to make it clear that I am not in anyway qualifying the the quality of the code or the control (which I believe to be more than satisfactory), only the controls suitability for any particular purpose. This is not a disclaimer, just the authors way of letting you know up-front that this control is a 95%'er, and if you want to use this version in your application you may need to provide the additional 5% to make it fit your particular purpose. Having said all that (and if I haven't scared you away), then if you are willing to live with the basic architecture I chose for this control you should find that adding your 5% is a relatively simple exercise.
As with any custom control, the basic mechanics for using it are:
A key aspect regarding adding the control to the Toolbox is that it must be the debug version because the designer support is not compiled into the release version as it is intended to be a run-time re-distributable.
Once an instance of the IconPanel is added to the form, select it and view its properties. The following properties control the most significant behavior and look and feel of an IconPanel control:
Style - Style provides an enumeration with the following possible values: { Custom, Classic, WindowsXP, Longhorn }. Which of these you choose has a significant impact on both behavior and look & feel
Again, the look and feel is similar, not exact. I simply wanted to get the flavor of the different Microsoft implementations and in no way did I feel like I needed to be a slave to the exact look and feel. Two obvious examples are that my animation algorithm is completely different from that used by both WindowsXP and Longhorn. I like their animation, I like my animation. You decide what you like and if its different from mine feel free to augment/change it.l Another example is that the Longhorn implementation is more of a look and feel "flavor" and the number of differences between my implementation and the actual is quite significant. Once again, I leave it as an exercise to the reader to implement something more exact (but please share it with the rest of us!)
Orientation - This property tells the IconPanel which direction it should be oriented and allows one of the following: {Auto, Vertical, Horizontal }
Items - This property defines the collection of tool items that may appear in the IconPanel
Items have a number of properties that define its name, description, images (1 per state), whether it is enabled, visible, etc. While you can easily define tool items in the designer using the standard collection editor, for more dynamic scenarios you should be prepared to create these on-the-fly. Of course you can always pre-define every possible tool and simply change the visibility (or disable them) as the context of the application changes. Choose whatever works for your application.
Other Properties of primary interest are:
My overall implementation strategy (i.e., architecture and design) and key decisions for the implementation of IconPanel are:
One could easily argue that my approach is not the correct or most flexible approach. For example, one might choose to implement IconPanel by deriving from panel, then allowing actual controls (Button, Label, etc.) into the panel and using various styles of form layout to automatically arrange the items in the panel. As an added bonus, the IconPanel would not need to provide any special mouse handling as the individual controls could provide it themselves. Overall, this approach might lead to a more powerful control with additional end-user features and benefits. It just so happens in this case that it was easier for me to develop it to do exactly what I needed it to do.
If you can live with the architecture then you should find it fairly easy to extend and I've made a reasonable effort to document it knowing that it's only a 95'er and you'll need to be able to get in and tweak it.
As always, I wrote this one for the fun of it and I hope you find some use for it. If you want to look at the implementation of the control just check out IconPanel.cs in the source zip. There are a bunch of support files there, most of them related to designer time stuff that really are used directly by the IconPanel itself. The source also includes an NDoc configuration file to generate documentation.
If you have any questions regarding the implementation drop me a line and i'll do my best to get back to you.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 21 Sep 2004 Editor: Nishant Sivakumar |
Copyright 2004 by Tom Guinther Everything else Copyright © CodeProject, 1999-2009 Web13 | Advertise on the Code Project |