Before you even download these files, it might be useful to read this article.
Introduction
I loved the Windows 7 New Features article, but I didn't liked that I had to enter all the code of those ToolbarThumbnailButtons, so I decided to create those controls by myself. It worked: I created a:
- Extend Aero Component
- Jumplist Component
- Overlay Icon Component
- Taskbar ProgressBar Component
- Thumbnail Toolbar Component
NEVER USE CONTROLS OF THE SAME Windows 7 Features Controls IN THE SAME FORM!Using the code
If you added the components to your form and set the properties, you have to call the
Private Sub TestForm_Shown(sender As System.Object, e As System.EventArgs) Handles MyBase.Shown
ExtendAeroComponent1.SetAero(Me) '(+2 overloads)
JumplistButtons1.SetJumplist() 'OR JumplistButtons1.AddJumplistLink(<Path>, <Title>, <Icon>)
OverlayIcon1.SetIconOverlay(Me) '(+2 overloads)
TaskbarProgressBar1.SetTaskbarProgressBar(Me) '(+1 overload)
ThumbNailToolbar1.SetThumbnailToolbarButtons(Me)
End Sub
As you saw you have to call a sub in the MyBase.Shown event.
Extend Aero
You can set the Aero properties at the design mode or in code, but always have to call ExtendAero1.SetAero to set the aero glass.
You can also call ExtendAero1.SetAero(Me, True) OR ExtendAero1.SetAero(Me, 50, 50, 50, 50) to set all the aero extensions to 50.
Jumplists
Jumplists. I'm sure you'll know something about these. Even Visual Studio 2010 uses them! So how do you use this control?
If you set the properties (the Images property was a bit difficult for me, so if there any suggestions...) you have to call JumplistButtons1.SetJumplist(). This will set everything in the jumplist. Make sure that if you add three JumplistLinks, you add three PathList and Images too!
You can also call: JumplistButtons1.AddJumplistLink(<Path>, <Title>, <Icon>)
Windows will remember the jumplist for the following time the program runs. To clear the jumplist, call JumplistButtons1.ClearJumplist()
Overlay Icons
Perhaps you don't know these, but here I'll show you:
You can see a little start hovered logo. This works with other icons too.
As usual, you have to call OverlayIcon1.SetIconOverlay(Me) OR OverlayIcon1.SetIconOverlay(Me, <IconLocation>) OR OverlayIcon1.SetIconOverlay(Me, <Icon>)
TaskbarProgressBar
I'm sure you have seen this before in a file copy/move/etc. in Explorer.
To use this, you can use TaskbarProgressBar1.SetTaskbarProgressBar(Me) OR TaskbarProgressBar1.SetTaskbarProgressBar(Me, <CurrentValue>, <CurrentMaximum>, <ProgressState>)
ThumnailToolbar
You can use maximum seven ThumbnailToolbarButtons.
If you have set all the properties you have to call ThumbNailToolbar1.SetThumbnailToolbarButtons(Me).
To use one of the events of these buttons, use the following code:
Dim WithEvents TTB1 As Microsoft.WindowsAPICodePack.Taskbar.ThumbnailToolbarButton
Private Sub TestForm_Shown(sender As System.Object, e As System.EventArgs) Handles MyBase.Shown
ThumbNailToolbar1.SetThumbnailToolbarButtons(Me)
TTB1 = ThumbNailToolbar1.TTB1
End Sub
Private Sub TTB1_Click() Handles TTB1.Click
MessageBox.Show("Hello world")
End Sub
References
If you use any of the controls into your project, add a reference to the DLL files in the DLL zip file:
- Microsoft.WindowsAPICodePack.dll
- Microsoft.WindowsAPICodePack.Shell.dll
and import
- Imports Microsoft.WindowsAPICodePack.Shell
- Imports Microsoft.WindowsAPICodePack.Taskbar
- (These two are not required, but it saves a lot of time.)
Remember
NEVER USE CONTROLS OF THE SAME Windows 7 Features Controls IN THE SAME FORM!