ComponentOne Windows 7 Control Pack for WinForms
Windows 7 Control Pack for WinForms Task-Based Help / C1TaskbarButton Task-Based Help / Working with the Taskbar Button / Adding an Overlay Image to the Taskbar Button
In This Topic
    Adding an Overlay Image to the Taskbar Button
    In This Topic

    The overlay image is used to communicate information with a user about the state of an application. The C1TaskbarButtons overly icon can be set at design time in the Properties window or can be set via code for run time interaction. It is more common to see this property set when a specific event occurs at run time, but this topic will explain how to do it both ways.

    Note: The icon overlay should always be 16 pixels by 16 pixels.

    In the Designer

    In the Properties window, click the ellipses button next to the OverlayIcon and select your image from the Image dialog box.

    In Code

    Usually, you'll want to use an overlay icon in response to an application state, response, or event. The easiest thing to do is to add your preferred .ico file to the project as a resource or to use the existing system icons.

    This example illustrates how to add an overlay icon to a simple Button_Click event using system icons.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    taskbarButton.OverlayIcon = New Icon(SystemIcons.[Error], 16, 16)
    

    To write code in C#

    C#
    Copy Code
    taskbarButton.OverlayIcon = new Icon(SystemIcons.Error, 16, 16);
    

    This example illustrates how to add an overlay icon to a simple Button_Click event using an embedded .ico resource named "Error".

    To write code in Visual Basic

    Visual Basic
    Copy Code
    taskbarButton.OverlayIcon = Properties.Resources.[Error]
    

    To write code in C#

    C#
    Copy Code
    taskbarButton.OverlayIcon = Properties.Resources.Error;