Creating controls that resemble the Microsoft control suite. 1 - Introduction.
Part I - An understanding and the first step into the unknown
One of my biggest gripes during the advancement of the Visual Basic language (and probably my only gripe in .NET) is the control set that Microsoft distributes. With each release of Windows and various other Microsoft products, the environment changes to keep our ever increasing thirst for change satisfied. The only disadvantage with this is that Microsoft obviously feels that we shouldn't be exposed to those "if only we could" controls. This stance by Microsoft has kept the 3rd party control developers market very lucrative. We have had the ability to use Visual Basic to accomplish some of what we desire, although sometimes only the hardiest developers tread those paths. Using the .NET suite opens doors that most Visual Basic developers have never stepped through, we have all the power we need, and all we need to do is to learn how to harness it.
Whilst the control library included with .NET is much more feature rich than in previous Visual Basic releases; it still leaves us feeling a little empty. Microsoft has tried to create a common interface for its controls (and with good reason). The labels caption property has now been replaced with the new Text property, as has the caption property on the button (formally commandbutton). The new menu editor make creating and managing menus at design time a pleasure, although they still look like the ones from Visual Basic 3. This goes some way to achieve a commonality between the controls, although one has to ask questions like "Why is there a readonly property on the textbox but not on the combobox?"
The following series of articles will demonstrate how to create a feature rich set of controls that will be the backbone of all your future .NET developments, and of course will resemble the current Microsoft look-and-feel. You'll learn some of the does and don't of the language and hopefully along the way will come to love the language as much as I have!
Maybe it's me, but I love my applications to look and feel like they are the hottest product off the shelf. The easiest was to achieve this is to build a control library that you can enhance and upgrade with time; giving your applications a short back-and-sides every so often.
One component that doesn't remain static is the toolbar (not surprisingly based on the title of this article). We have seen a wide variety of toolbars from Microsoft, and not surprisingly the latest version of the .NET suite comes with its own bundle of joy.
For a development of this scale I found it difficult not to dive into developing using all the "hacks" that I'm accustomed to using in order to achieve an equivalent look. Instead I opted to investigate the language first (a much more sensible approach). During the course of this article I have taken almost as many steps backwards as forwards as I have learnt and understand more of the .NET framework. I'm sure that this will be only the first of many revisions of this article; Microsoft may even distribute an equivalent toolbar with the final release of Visual Studio .NET.
Before stepping into the unknown and creating a control of the complexity of the toolbar we must first design and plan an object hierarchy for our new tool suite. Since the toolbar needs various control contained within it to function; we should consider creating these controls first. With all the new OO features new included with Visual Basic .NET, we now have the capability to deliver this result in a correct manner and with a structured approach.
The first thing we need to decide is what controls we would like to have this new look-and-feel, and what we require them to do in addition to the normal duties they perform. I have listed the controls that this article will cover - the list is likely to grow as I consider new controls that lend themselves to this style.
|FlatButton||A button that has the new GUI styling of .NET|
|FlatCombo||A flat style combobox, again using the new look|
|FlatTextbox||You've guessed it|
|FlatListboxExtended||A listbox that will allow "fast" population of large quantities of data.|
|FlatMainMenu||The new "Main Menu" look and feel|
|FlatMenuItem||The popup menu class, this control also doubles as the dropdown from the FlatMainMenu|
To be continued ...