Changes in a custom icon for a Windows form may not appear in the upper-left corner of the form in Visual Studio 2005 (914349)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition SP1
  • Microsoft Visual C++
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)

SYMPTOMS

After you change the custom icon for a Microsoft Windows form in Microsoft Visual Studio 2005, your changes may not appear in the upper-left corner of the form. This behavior occurs when the Icon property of the form is set to a custom icon file.

Note This problem does not occur in Microsoft Visual Basic .NET 2003 or in Microsoft Visual Basic .NET 2002.

CAUSE

This issue occurs because the 16-pixel-by-16-pixel version of the icon that is used for the form has not been changed. By default, Visual Studio 2005 creates both a 32-pixel-by-32-pixel version and a 16-pixel-by-16-pixel version of new icons. By default, when you change an icon in Visual Studio 2005, the 32-pixel-by-32-pixel version of the icon is updated. Windows forms use 16-pixel-by-16-pixel icons.

Note This issue occurs in Microsoft Visual C++, in Microsoft Visual C#, and in Microsoft Visual Basic 2005. Both Visual Basic 2003 and Visual Basic 2002 use 32-pixel-by-32-pixel icons and are not affected by this problem.

WORKAROUND

To work around this issue, modify the 16-pixel-by-16-pixel version of the icon. To do this, follow these steps:
  1. Start Visual Studio 2005.
  2. In Solution Explorer, right-click the icon file, and then click Open.
  3. On the Image menu, point to Current Icon Image Types, and then click 16x16 256 Colors.

    Note If the 16x16 256 Colors option is unavailable, click New Image Type on the Image menu, and then double-click 16x16 256 Colors.
  4. Modify the icon image by using the tools that are provided in Visual Studio.

    Note This icon image is the icon image that the Windows form will use.
  5. On the File menu, click Save FileName.
  6. On the File menu, click Close.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Create a new Windows Application project. To do this, follow these steps:
    1. Start Visual Studio 2005.
    2. On the File menu, point to New, and then click Project.
    3. In the Project types list, click Windows.
    4. In the Templates list, click Windows Application, and then click OK.
  2. Add an icon file to the project. To do this, follow these steps:
    1. In Solution Explorer, right-click the name of the project, point to Add, and then click New Item.
    2. Click Icon File, and then click OK.
    3. Change the icon.
    4. On the File menu, click Save Icon1.ico.
  3. Add the new icon to the form. To do this, follow these steps:
    1. In Solution Explorer, double-click Form1.cs.
    2. Under Properties, set the Icon property to Icon1.ico.

      Note The icon image under Properties appears correctly. However, the icon image on the form does not appear correctly.
  4. On the Debug menu, click Start Debugging.

    Note The icon on the form does not appear correctly.
For more information about how to create icon files for Windows applications by using Visual Studio and Microsoft Paint, visit the following Web site:

Modification Type:MajorLast Reviewed:4/14/2006
Keywords:kbnofix kbtshoot kbprb KB914349 kbAudDeveloper