BUG: Error Message When You Try to Add an Icon to an ImageList Control: Invalid Parameter Used (316652)



The information in this article applies to:

  • Microsoft GDI+ 1.0
  • Microsoft .NET Framework 1.0
  • Microsoft .NET Framework 1.1

This article was previously published under Q316652

SYMPTOMS

When you try to create an Image object from a 24-bits-per-pixel (BPP) or 16-BPP icon, you may receive an error message that is similar to the following:
OutOfMemory
Or, when you try to add a 24-BPP or 16-BPP icon to an ImageList control, or when you open an icon in a PictureBox control, you may receive the following error message:
Invalid Parameter Used

CAUSE

This behavior can occur because the System.Drawing method is based on GDI+. There is a bug in GDI+ that prevents it from loading certain 24-BPP and 16-BPP icons with no color tables. You may also experience this problem when you try to populate an ImageList control, because of the control's reliance on GDI+.

RESOLUTION

To work around this issue, use a 32-BPP or a 256-BPP icon instead of a 24-BPP icon.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.

MORE INFORMATION

Steps to Reproduce the Problem

  1. Start Visual Studio .NET.
  2. Create a new C# Windows application.
  3. Add an ImageList control to the form.
  4. Click the ellipsis button (...) in the Properties section of the form to edit the ImageList object collection.
  5. Attempt to add a 24-BPP or 16-BPP icon. You receive an error message similar to the following:
    Invalid Parameter Used

Modification Type:MinorLast Reviewed:4/3/2006
Keywords:kbDSWGDI2003Swept kbbug kbCtrl kberrmsg kbIcon KB316652