Microsoft KB Archive/316652

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

Article ID: 316652

Article Last Modified on 2/22/2007

-

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 &quot;Applies to&quot; section of this article.



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

Invalid Parameter Used

</li></ol>

Keywords: kbdswgdi2003swept kbbug kbctrl kberrmsg kbicon KB316652

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.