BUG: You cannot use the ImageList property to add images whose size is 32x32 (834532)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
SYMPTOMSIf you set the ImageSize property of an ImageList component to 32x32, you cannot later add images that are 32x32 to
the ImageList component.
Although you receive no design-time errors,
you notice during run time that the ImageList component contains no images.
This behavior occurs only
if the ImageSize property is set before you add images. This behavior can only be reproduced with images
whose size is 32x32.CAUSEIf you set the ImageSize property to 32x32 before you add images that are 32x32, the
following statement is removed by Microsoft Visual Studio .NET: Me.ImageList1.ImageStream = _
CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
This change causes the image resource not to be loaded at
runtime. Note Although the sample is written in Microsoft Visual Basic .NET, you
can reproduce the behavior by using any other programming language in Visual
Studio .NET. For example, you can reproduce the behavior by using Microsoft
Visual C++ .NET or Microsoft Visual C# .NET. RESOLUTIONTo resolve this problem, you can add the image to the ImageList component, and then modify the ImageSize property of the ImageList component in design mode. To resolve this problem, follow these
steps:
- In the Properties dialog box of the ImageList1 control, click Images, and then click the
ellipsis button (.).
- Add an icon file in the Image Collection
Editor dialog box. The icon file must be 32x32.
- On the View menu, click
Designer to switch to design mode, and then expand the
Windows Form Designer generated code node.
- Locate the following code:
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) Replace the previous code with the following code:Me.ImageList1.ImageSize = New System.Drawing.Size(32, 32)
WORKAROUNDTo work around this problem, follow the steps to reproduce
the behavior in the "More Information" section, except replace steps 10 through
12 with the steps that are listed in the "Resolution" section. STATUSMicrosoft
has confirmed that this is a problem in the Microsoft products that are listed
in the "Applies to" section.REFERENCESFor more information about the ImageList class, visit the following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 9/14/2005 |
---|
Keywords: | kbvs2002sp1sweep kbIcon kbWindowsForms kbcode kbBug KB834532 kbAudDeveloper |
---|
|