Developing with the Taskbar in Windows 7
page 5 of 7
by Sergey Zwezdin
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 33430/ 73

Overlay icons

This possibility is useful if applications have any state from a user point of view. As example of such, applications can be programs for instant messages. For instance, Windows Live Messenger uses this possibility. If you open Windows Live Messenger and change a state, you can see how it is displayed on the task panel.

Figure 4: Overlay icons of Windows Live Messenger

To add a state icon to the main icon of the application, it is necessary to add a resource file in the project and to place there the necessary icons. Also, it is possible to receive Icon objects from another place if it is necessary.

Now you need to use methods of expansion that allows us to set icons for our application. For these purposes SetTaskbarOverlayIcon method is defined. As parameters of this method we should pass our form, an icon and description. Thus, code of a new icon setting up is like the following.

Listing 6: Setting up overlay icon

WindowsFormsExtensions.SetTaskbarOverlayIcon(this, Icons.Error, "Error");

Also, it is possible to remove this icon. For this purpose it is necessary to pass null value instead of the icon.

Listing 7: Clearing overlay icon

WindowsFormsExtensions.SetTaskbarOverlayIcon(thisnull, String.Empty);

You can also imagine another scenario where, instead of an additional icon, any information can be displayed. For example, it can be the current download speed if your software downloads something from a network. Or it can be quantity of new letters in a mail box if it is a mail client.

As the second parameter in SetTaskbarOverlayIcon method object Icon is passed, it is possible to generate this object dynamically. Let us take advantage of a simple code and do it. We will create a method which will generate such an image.

Listing 8: Generating icon dynamically

private static Icon BuildIcon(int param)
    Bitmap image = Icons.BLANK2334242;
        new Font("Arial", 54), Brushes.White, 10, 25);
    return Icon.FromHandle(image.GetHicon());
private void ShowStatus(object sender, EventArgs e)
    WindowsFormsExtensions.SetTaskbarOverlayIcon(this, BuildIcon(50, "Status");

Thus, thanks to BuildIcon method, a new icon which will be generated and displayed on the task panel.

In this example you can see that a text was added to a standard icon and the result was displayed on the task panel. In this demonstration application there is a timer which simulates the work of a download manager, giving out different "speeds" of downloading constantly.

View Entire Article

User Comments

Title: Source Code & Windows 7 Lib   
Name: Willy
Date: 2011-01-13 9:07:34 PM
hi sergey, your article is amazing
please send me the source code, I need to improved my application, email me at

I wonder where is download the windows 7 library for C# visual studio .net 2008, my application running on it.

many thanks.
Title: Re: Attach Full Source Code   
Name: Sergey Zwezdin
Date: 2010-03-08 12:54:15 AM
Ashish, send me mail-request, please?
Title: Attach Full Source Code   
Name: Ashish Kumar
Date: 2010-03-07 3:26:16 AM
please attach full source code with this article.
Title: reviews   
Name: r4 dsi
Date: 2009-11-30 5:43:34 AM
Windows 7 is more than what Vista should have been, it's where Microsoft needed to go. How much damage Vista did and whether Windows 7 is enough for people to finally abandon Windows XP are questions that nobody has the answers to right now.
Title: Amazing !   
Name: Aamod Thakur
Date: 2009-11-06 4:15:19 AM
Amazing Article, Very Informative.

Thanks Sergey

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2022  |  Page Processed at 2022-10-06 4:30:20 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search