Last month we checked the Windows API Code Pack for .NET ? an open source release from Microsoft that lets you add Windows 7 features into your .NET applications with ease. This month we continue from where we left and add a few more features into the mix. So let's jump right in for the code.
Customizing the thumbnail
One of the coolest new features of Windows 7 is the new interactive thumbnails shown for each running application. Not only can you perform an 'Aero Peek' into the window by simply hovering your pointer over a particular thumbnail, but you can also click it to switch, close the window, view tabbed or child windows and more. All these features are available to your application running on Windows 7 for 'free' ? that is, you don't need to add any code to get them. However, there are a number of other features that you can use to make your app look even better by simply adding a few lines of code.
One of the coolest new features of Windows 7 is the new interactive thumbnails shown for each running application. Not only can you perform an 'Aero Peek' into the window by simply hovering your pointer over a particular thumbnail, but you can also click it to switch, close the window, view tabbed or child windows and more. All these features are available to your application running on Windows 7 for 'free' ? that is, you don't need to add any code to get them. However, there are a number of other features that you can use to make your app look even better by simply adding a few lines of code.
Thumbnail toolbars
The first new feature is the ability to add a toolbar on the thumbnail that contains buttons for users to click and have it interact with the main window. You can see an example of this in the new Windows Media Player that adds buttons allowing skipping, pausing and playing of content. To do this yourself you will need to add a little bit of code. So let's try this out by using the Windows Forms application we created last month and continue to build upon it.
The first new feature is the ability to add a toolbar on the thumbnail that contains buttons for users to click and have it interact with the main window. You can see an example of this in the new Windows Media Player that adds buttons allowing skipping, pausing and playing of content. To do this yourself you will need to add a little bit of code. So let's try this out by using the Windows Forms application we created last month and continue to build upon it.
Thumbnail Clipping
One thing you will notice when you run the above code is that the entire application is shown in the thumbnail, since by default, Windows 7 captures the entire client area of the window for it. However, you might want to show only a (more relevant) part of the window in the thumbnail. In this sample, you might want to only show the image that is shown in the picture box in the thumbnail without all the other trimmings around it. For this, you will need to use a feature called thumbnail clipping. Using this feature, you can decide on a relevant part of your application's main window that you wish to highlight in the thumbnail and get the bounding rectangle for that and display it.
One thing you will notice when you run the above code is that the entire application is shown in the thumbnail, since by default, Windows 7 captures the entire client area of the window for it. However, you might want to show only a (more relevant) part of the window in the thumbnail. In this sample, you might want to only show the image that is shown in the picture box in the thumbnail without all the other trimmings around it. For this, you will need to use a feature called thumbnail clipping. Using this feature, you can decide on a relevant part of your application's main window that you wish to highlight in the thumbnail and get the bounding rectangle for that and display it.
As you can see, customizing what your users see in the thumbnail of your application is quite easy. You can really enhance their producitivty in using your application by simply adding a few lines of code. Till next time, have fun.