Geeks With Blogs
Sergey

Windows 7 +1

As we already saw, Windows 7 possesses convenient functionality for display preview of windows of applications. It is possible to look the reduced representation of a window for few seconds at mouse hover at a window icon in the task panel. It is very convenient when at the user openly considerable quantity of windows.

All contents of a window are displayed by default in these preview . However, for some appendices it would be much more convenient to show in preview not all contents of a window, but only its part. Such functionality also is provided for the task panel of Windows 7 and we can use it for the out applications. Let's understand this possibility of the task panel of Windows 7.

As usually we will use for this purpose .NET Interop Sample Library. In wrappers for functions from system libraries of Windows here there is SetThumbnailClip method which will help us with implementation of the given functionality. By a call of the given method in parametres it is necessary to transfer a current form and the co-ordinates limiting area of a window.

private void Clip5_Click(object sender, EventArgs e)
{
    WindowsFormsExtensions.SetThumbnailClip(this, new Rectangle(10, 10, 145, 145));
}

On this example it is well visible that to use this method very easily.

Let's create the small application where we will look at possibilities of this functionality. For this purpose I will create the empty application in which I will add some some controls. After an application launch preview windows will look as follows.

image

It is visible, that in preview all window is displayed. Let's limit area of display by means of SetThumbnailClip method. Let's display, for example, only entry fields which are on the form.

image

It is interesting, that if the form has a dynamic content (for example, video) it will be displayed in dynamics. I have placed some animated images and have displayed them in preview in the my demonstration application. Thus there is no necessity for this purpose to do something else.

image image

It is important, that we can change contents preview in the course of application work. For example, during any moment of time it can be necessary to display contents of some important entry field, and during other moment - to display the image from the form. Such dynamism can give the chance to receive to the user the actual information for it.

Finally, if it is necessary for us to display all contents of the form it is possible to use the same method, but to pass it the sizes of all form. In this case all window will be displayed in preview again.

private void NoClip_Click(object sender, EventArgs e)
{
    WindowsFormsExtensions.SetThumbnailClip(this, new Rectangle(new Point(0, 0), Size));
}

Sample application:

Posted on Tuesday, May 26, 2009 4:03 AM | Back to top


Comments on this post: Windows 7 programming: Taskbar. Part 7 – ThumbnailClip.

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © | Powered by: GeeksWithBlogs.net