Hi !
I installed the VCL Installer v29. Since that update we have problem with loading an image into the button. Before that version, everything was fine.
The command I use is the following :
Data.ImageListEnabled.GetBitmap(17, btAfdrukVoorcalc.Glyph);
The image appears as a white square in the button.
I included a screenshot as attachment.
Many thanks in advance,
Nico Callewaert
We have closed this ticket because another page addresses its subject:
Loading a glyph from an ImageList, image isn't displayed in dxBarButtonTcxButton - Glyph loaded from an ImageList looks corrupted
Answers
Hi Nico,
Thank you for the sample project. Yes, I do see the problem and, as I discovered, it has the same nature as the issue described in report B18452 ("Loading a glyph from an ImageList, image isn't displayed in dxBarButton"). So, it requires the same solution:
Delphitype
TBitmapAccess = class(TBitmap);
...
btAfdrukVoorbeeld1Project.Glyph.PixelFormat := pf24bit;
btAfdrukVoorbeeld1Project.Glyph.Canvas.Brush.Color := clFuchsia;
btAfdrukVoorbeeld1Project.Glyph.Canvas.FillRect(Rect(0, 0, 16, 16));
ImageListEnabled.GetBitmap(1, btAfdrukVoorbeeld1Project.Glyph);
TBitmapAccess(btAfdrukVoorbeeld1Project.Glyph).Changed(nil);
In the meantime, I want to repeat that our TcxImageList is free of this problem and allows you to use a simple code:
DelphicxImageList1.GetImage(1, btAfdrukVoorbeeld1Project.Glyph);
I have attached the updated version of your sample.
Thanks,
Serge
9 years later we have this problem ;)
So there is no solution because the WinForms ImageList, still has a problem?
Hello Jürgen,
This ticket is related to an older version of our VCL components, but not WinForms controls. I have checked the project provided by Serge with the latest version of our VCL controls (16.1.3) and confirm that the approach he suggested still works correctly after these 9 years. If you found a similar problem with our WinForms controls, I kindly ask that you create a new ticket, and provide there a small sample project and a description demonstrating the problematic behavior. Thanks in advance.
Hi Nico,
We were informed of similar issues, and as we discovered, they are caused by the ImageList's GetBitmap method - it corrupts the resulting image. For more information on this item, please take a look at report B18452 ("Loading a glyph from an ImageList, image isn't displayed in dxBarButton"). If you are using a TcxImageList, please use its GetImage or GetImageInfo methods instead. They should work OK.
In the meantime, this sounds rather odd that the problem was raised only in the last update 29. So, we would like to examine a sample project, if you can provide one, to give you a precise answer.
Thanks,
Serge