472,331 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

Problems with ImageList.. need help

I have a problem that just cropped up with using an ImageList in my project
I am using VB .NET 200

I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and ImageList24 (for 24x24). I have inserted images in each and it has worked fine for months... The System.Drawing.Bitmap properties for these images are PixelFormat=32bppArgb and RawFormat=MemoryBmp with the Horiz and VerticalResolution = 96

I installed DirectX9.0

The next time I went to add a Image to the ImageList all of my new images are being inserted as PixelFormat = Format8bppIndexed and RawFormat = Bmp with the Horiz and VertResolution = 71.9836. This is causing all my new images to not remove the transparent color

I used System Restore points to move my system configuration back prior to DirectX9 but it was to no avail... My images are still being inserted incorrectly. In fact all my older components are also now suffering from the same problem...

Things I've tried...
1. I have tried creating a new Image List but it too has the same proble
2. Changing System Color depth and resolution in different combination
Nothing has worked... I have months invested in this program and need help... The old images still work fine but I desperately need to be able to add new images. Any help or suggestions would be appreciated



Nov 20 '05 #1
4 4121
Hi David,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that after you install directx9.0b, the
imagelist will not work on your machine.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

Is the DirectX 9.0b you have installed the one in the windows update
website, or is it a runtime or a directx 9.0 sdk?
Based on my knowledge, the DirectX library will not impact the ImageList
which will use the comctl32.dll underlying.

Also I can not reprodue the problem that all the new image added into the
imagelist are all PixelFormat = Format8bppIndexed and RawFormat = Bmp, on
my side the two properties will depend on the real format of the image.

Have you tried to create a new windows form project and add a imagelist
,and then add a few pictures into the imagelist, did the problem persists?
If no, can you build a simple reproduce sample and post here or send to me
by removing the "online" from my email address.

But I can reproduce the problem that we can not change the transparentcolor
of the imagelist in the IDE designer. As a workaround, I think we can try
to rebuild the imagelist on the fly everytime we need to change the
Here is the code snippet, you may have a try and let me know the result.


Dim il As ImageList
Private Sub RebuildImageList()
If Not il Is Nothing Then
End If
il = Nothing
il = New ImageList
il.ColorDepth = ColorDepth.Depth32Bit
il.ImageSize = New System.Drawing.Size(32, 32)
il.Images.Add(New Bitmap("C:\red.bmp"))
il.Images.Add(New Bitmap("C:\blue.bmp"))
il.Images.Add(New Bitmap("C:\green.bmp"))
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
components = New System.ComponentModel.Container
il = New ImageList
il.TransparentColor = Color.Blue
For i As Integer = 1 To 12
Me.ListView1.Items.Add(i.ToString(), i Mod 3)
Me.ListView1.LargeImageList = il
End Sub
Shared times As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim c As Integer = times Mod 3
Select Case c
Case 0
il.TransparentColor = Color.Green
Me.ListView1.LargeImageList = il
Case 1
il.TransparentColor = Color.Red
Me.ListView1.LargeImageList = il
Case 2
il.TransparentColor = Color.Blue
Me.ListView1.LargeImageList = il
End Select
times += 1
End Sub


Please apply my suggestion above and let me know if it helps resolve your

However, if the problem still persists, please help me collect more
information for further troubleshooting.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
I created a new project as suggested and inserted 3 images into the ImageList. All of them were inserted with the same properties for the Image as I pointed out earlier
PixelFormat=Format8bppIndexed, RawFormat=Bmp, Vert & Horiz Resolution = 71.9836, Transparent Color = Magent
All the Images appear in the list of Images with Magenta backgrounds (not shown with transparent backgrounds like I am used to seeing

However when I create a button and set the ImageList property to ImageList1 and ImageIndex to 0 I get the transparent image showing on the button (technically perfect...) But when I check the properties of the Image from the button control properties. The properties are set to
PixelFormat=Format32bppArgB, RawFormat=MemoryBmp, Vert & Horiz Resolution = 96, Transparent Color = 9

Very strange (at least I think so)

Any thoughts.. Is this the correct behaviour for the ImageList
It seems to be working but it makes me a little nervous


Nov 20 '05 #3
Hi David,

I have got your reproduce sample, since the bitmap in the imagelist has
been serialized into the resource file, the properties of the bitmap I can
see is PixelFormat=Format32bppArgB, RawFormat=MemoryBmp, Vert & Horiz
Resolution = 96, Transparent Color = 96 just as you have pointed out.

Have you tried checked the original bitmap file properties to see what is
its original properties by following the steps below?
1. browse to the bitmap file(e.g. red.bmp) in the windows explorer
2. right click on the red.bmp file and select properties
3. select the Summary tab and observe the image property(if you did not see
the image property please click the advance button)
4. What is the original Bit Depth of the bitmap file and its size? Did it
fit what you have seen before(PixelFormat=Format8bppIndexed, RawFormat=Bmp,
Vert & Horiz Resolution = 71.9836)?

As for the Image Property will be "PixelFormat=Format32bppArgB,
RawFormat=MemoryBmp, Vert & Horiz Resolution = 96, Transparent Color = 96",
I think the behavior is correct, because if we look into the code in the
InitializeComponent sub which was generated by the IDE designer.
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream" ),
Me.ImageList1.TransparentColor = System.Drawing.Color.Green

We will find that the image in the ImageList1 will be retrieve from a
memory stream, so the properties will be MemoryBmp and the size and modify
as we have defined in the imagelist property. The
PixelFormat=Format32bppArgB is to maintain the max available color depth.

So I think we do not need to worry about the RawFormat=MemoryBmp, it will
be handled by the IDE.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
In reviewing everything it appears that your explanation covers off why the format is being morphed to the different format. You are also correct in the original image being the settings that I was getting on the insert.
What is still odd to me is that the transparent color still appears on the image in the ImageList (but not the original 3 images).

My best guess is that the Image List was copied and pasted from a previous form and perhaps this copying of the ImageList is changing the image properties (probably because of the serializing of the images).

In the meantime I guess that we can close this thread as I think it will probably still work fine. I appreciate your input


Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: SpaceMind | last post by:
Hi, I´m using this code for changing the size property of an ImageList : ImageList.ImageSize = new Size(32,32); However , the Icon property just...
by: MB | last post by:
Hi a guys 02 questions a bout imageList please help me if you have an idea 1) I have a strange probleme with imageList, I added some images at...
by: Bob C. | last post by:
Hi All, I am using the ImageList/ListView Components to display around 100 images in C#.NET. The issue i have is, some times i may need to...
by: felix | last post by:
Hi, I tried google and searched the old posts -- with no success. Like a zillion of people before I have a problem when rendering transparent...
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large...
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image...
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an...
by: Archimed | last post by:
Hi, I try to use an ImageList with a ListView but that don't work. I make a ListView in VirtualMode with LargeIcon view. I put the ImageList...
by: wolffy | last post by:
okay heres my problem; i want to add image K to a imagelist, thats easy. The hard part is that the imagelist was made in Application Settings. **I...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.