Hi,
I've been searching a lot for this and I found a solution but not exactly working as I expected.
I have an ImageList with a list of images in PNG format and I want to add one of those images to the icon propertie in a status bar for instance.
The image on ImageList is System.Drawing.Bitmap and the icon on the statusbar is System.Drawing.Icon, that means I can't do this:
so, after my search I found this, wich works:
However, the problem is right here, the transparency of the iamge is not there and so the images looks weird, but it works; but I want it to work with transparency. By the way, I tested with PNG and ICO files, but the results were the same.
If I load the image directly from my hard drive to the icon property, it works fine, the transparency is there.
So, what can I do to ahve the trasnparency stay there using and ImageList? I want this because the status bar will have a different image depeding on some factors.
Any help?
I've been searching a lot for this and I found a solution but not exactly working as I expected.
I have an ImageList with a list of images in PNG format and I want to add one of those images to the icon propertie in a status bar for instance.
The image on ImageList is System.Drawing.Bitmap and the icon on the statusbar is System.Drawing.Icon, that means I can't do this:
Code:
Me.StatusBar1.Icon = Me.ImageList1.Images(0)
so, after my search I found this, wich works:
Code:
Dim icoStatus As Icon
icoStatus = Icon.FromHandle(DirectCast(Me.ImageList1.Images(0), Bitmap).GetHicon)
Me.StatusBar1.Panels(0).Icon = icoStatus
However, the problem is right here, the transparency of the iamge is not there and so the images looks weird, but it works; but I want it to work with transparency. By the way, I tested with PNG and ICO files, but the results were the same.
If I load the image directly from my hard drive to the icon property, it works fine, the transparency is there.
So, what can I do to ahve the trasnparency stay there using and ImageList? I want this because the status bar will have a different image depeding on some factors.
Any help?