473,695 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Problem:

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=32b ppArgb and RawFormat=Memor yBmp with the Horiz and VerticalResolut ion = 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 = Format8bppIndex ed 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

Thanks

David

Nov 20 '05 #1
4 4329
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 = Format8bppIndex ed 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 transparentcolo r
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
transparentcolo r.
Here is the code snippet, you may have a try and let me know the result.

<code>

Dim il As ImageList
Private Sub RebuildImageLis t()
If Not il Is Nothing Then
Me.components.R emove(il)
End If
il.Dispose()
il = Nothing
il = New ImageList
il.ColorDepth = ColorDepth.Dept h32Bit
il.ImageSize = New System.Drawing. Size(32, 32)
il.Images.Add(N ew Bitmap("C:\red. bmp"))
il.Images.Add(N ew Bitmap("C:\blue .bmp"))
il.Images.Add(N ew Bitmap("C:\gree n.bmp"))
Me.components.A dd(il)
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
components = New System.Componen tModel.Containe r
il = New ImageList
RebuildImageLis t()
il.TransparentC olor = Color.Blue
For i As Integer = 1 To 12
Me.ListView1.It ems.Add(i.ToStr ing(), i Mod 3)
Next
Me.ListView1.La rgeImageList = il
End Sub
Shared times As Integer = 0
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim c As Integer = times Mod 3
Select Case c
Case 0
RebuildImageLis t()
il.TransparentC olor = Color.Green
Me.ListView1.La rgeImageList = il
Case 1
RebuildImageLis t()
il.TransparentC olor = Color.Red
Me.ListView1.La rgeImageList = il
Case 2
RebuildImageLis t()
il.TransparentC olor = Color.Blue
Me.ListView1.La rgeImageList = il
End Select
times += 1
End Sub

</code>

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

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
Interesting..
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=For mat8bppIndexed, 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=For mat32bppArgB, RawFormat=Memor yBmp, 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

Cheers

David
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=For mat32bppArgB, RawFormat=Memor yBmp, 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(PixelFor mat=Format8bppI ndexed, RawFormat=Bmp,
Vert & Horiz Resolution = 71.9836)?

As for the Image Property will be "PixelFormat=Fo rmat32bppArgB,
RawFormat=Memor yBmp, Vert & Horiz Resolution = 96, Transparent Color = 96",
I think the behavior is correct, because if we look into the code in the
InitializeCompo nent sub which was generated by the IDE designer.
'
'ImageList1
'
Me.ImageList1.I mageSize = New System.Drawing. Size(16, 16)
Me.ImageList1.I mageStream =
CType(resources .GetObject("Ima geList1.ImageSt ream"),
System.Windows. Forms.ImageList Streamer)
Me.ImageList1.T ransparentColor = 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=For mat32bppArgB is to maintain the max available color depth.

So I think we do not need to worry about the RawFormat=Memor yBmp, 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

Cheers

David
Nov 20 '05 #5

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

Similar topics

1
1004
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 lost´s his data. Before code: ImageList.Images.Count == 1 After:
0
1729
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 designtime and I can see the images but at runtime MessageBox.Show(imageList.Images.Count.ToString()); display 0 and imageList.Images fails
2
2303
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 display the thumbnail of size more then 256x256 in ImageList. But the ImageList Component supports only size upto 256x256. What is the best way to handle this?
4
15657
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 PNGs with GDI+ and the C# Graphics class. The image shows am object on a transparent background. I get ugly artifacts at the object's edge where the transparency begins. It looks as if there was a 8bit alpha reduced to 1 bit. Where there wasn't full transparency, the background (I suppose blue)...
2
8530
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 image size to 100, 100 here i am getting error like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control in .net(forms application) by chnging one trckbar(like tb1->Value),
0
341
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 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...
0
2855
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 imagelist for use in a listview: Private Structure SHFILEINFO Public hIcon As IntPtr ' : icon Public iIcon As Integer ' : icondex Public dwAttributes As Integer ' : SFGAO_ flags
4
14475
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 in the LargeImageList property. I add a bitmap to the ImageList When i want to see the item "icon" with the imagelist imageindex
0
1229
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 made the imagelist in application settings so i could eventually add in code which would make its value saved when the form closes** But every time i use something like this image k = toolstrip1.backgroundimage; Settings.Default.kill.Images.Add(k); **kill is the name of the imagelist** i get...
0
8652
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9005
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6511
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4599
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3025
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2291
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1987
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.