In this tutorial I'll show you how to add Windows Vista controls to your applications. Although, there are many wrappers available on the internet. The best in my opinion is of Nicholas Kwan from Code Project.
Tools you will need to complete the tutorial:
■ Windows Vista or Later.
■ At-least .NET framework 2.0
■ Visual Studio 2005 or Later.
This tutorial applies to all .Net languages including:
■ Visual Basic.NET
The wrapper from Nicholas Kwan includes the following controls:
1: Command Link
2: Tree View
3: Progress Bar
4: Split Button
5: List View
6: Image Button
So, let's start:
■ Create a new project in any language of the .NET
■ After the project is created, go to Toolbox and click choose items and then choose the included DLL in this tutorial.
These controls will be added:
Now let's take a look at the control individually:
■ Command Link:
Command Links are really just buttons, assigned with a different theme.
Here's what it looks like:
Drag the Command Link to the Form / User Control. Change its Text to anything you want like "Launch Gaming Section". Then re-size it so it wraps the text. Rest of the properties are same, like Enable / Disable etc...
■ Tree View and List View:
By default, Tree Views and List Views do not have the same look as that of Explorer:
This wrapper solves this issue and gives some cool look to the controls:
Same as default Tree view and List view controls of .NET . So I guess, no need to explain. But if you feel any difficulty, feel free to ask me via VM.
■ Progress Bar:
In Windows Vista, progress bars come in different flavors, the most common progress bar being the green one. However, there are also the red and yellow versions as well (there is a blue version, known as a meter, but that is inaccessible). The progress bar colors seem to correspond to specific progress bar states. We can set those states programatically.
Drag 3 progress bars to the form as shown above.
Now use the following commands to set the states. You can call it from where ever you want:
[PHP]VistaControls.VistaConstants.SendMessage(pb.Handle ,VistaControls.VistaConstants.PBMSETSTATE,VistaCon trols.VistaConstants.PBSTNORMAL,0)[/PHP]
[PHP]VistaControls.VistaConstants.SendMessage(pb2.Handl e,VistaControls.VistaConstants.PBMSETSTATE,VistaCo ntrols.VistaConstants.PBSTPAUSED,0)[/PHP]
[PHP]VistaControls.VistaConstants.SendMessage(pb3.Handl e,VistaControls.VistaConstants.PBMSETSTATE,VistaCo ntrols.VistaConstants.PBSTERROR,0)[/PHP]
In the above codes, pb, pb2 and pb3 are the names of the progress bars respectively.
■ Image Button:
Same as default button, but adds clean effect to the button when image is added. Also supports *.ico extension now.
■ Split Button:
Just like Command Links, Split Buttons are just simply buttons. However, even after setting the style, how are you going to associate a menu (context menu) to the button? We can do this by first associating an event which would be fired whenever a person clicks on the "drop down" on the split button. To do this follow the instructions below:
Add a split button to the form. Now go to the load event of the form and add the following code:
Dim Menu As New ContextMenu
Menu.MenuItems.Add( "Visual Basic")
Menu.MenuItems.Add( "C# / C++")
SplitButton1.Dropdownmenu = Menu
Change the SplitButton1 with the name of your split button. Change the items of the Context Menu as required.
Here's a screen shot:
Here's a screen shot of the controls we just discussed:
Hmm...I am still not finished. I am gonna show you another cool control which is a part of the windows vista and 7. It is a Task Dialog and you must be familiar with it:
This control has been written by Daniel Moth. I've attached the wrapper DLL of the Task Dialog and is named "TaskDialogWrapper.dll".
To use the Task Dialog, add the reference to the "TaskDialogWrapper" DLL. Now simply use the following line of code to show the Task Dialog:
TaskDialogWrapper.TaskDialog.Show( Me , "Virus Detected !", "Immediate Virus Scan Needed.", "Please do a virus scan as soon as possible or it will own you xD. To download the antivirus software goto: http://www.microsoft.com",TaskDialogWrapper.TaskDialogButtons.Close,TaskDia logWrapper.TaskDialogIcon.Shield)
Also, I am working on a custom control. It's also a part of Vista and 7. It is the BreadCumb control:
Hopefully, it will be completed in a day or two.
So, that's all for now. I'll add more controls as I'll browse through them.
If you are tired of the most advanced GUI's ever (The releaser that says on his every release), then step forward and start using these controls. They'll make your applications sleek and sweet. Make MPGH a bit more modern. All controls are highly customizable. Just play around with them a bit and you'll master them.
Here's Virus Scan:
Wrapper DLLs.zip MD5:d3788fccee9c04225c480877fb752359 - VirSCAN.org Scanners did not find malware!
If you need help with any control, just VM me and I'll help you out.
I hope this helps !!
Press Thanks if helped !!