Problems with GDIPicture on Alexandria

On Alexandria I've encountered particular problems with images loaded on AdvMetroButton.

a) loading Picture (Png,Jpg etc.) on designtime on a AdvMetrobutton raises an error due invalid graphic format
while using button.picture.loadfromfile on runtime works normally

b) metrobutton will painted often with wrong background different from his own parent-panel:
to reproduce just
create simple TForm with AdvMetrobutton on it. load some picture on it.
let recreate from this form a second instance of this form.

first instance displays fine, second instance has wrong background on metrobutton
  1. Can it be you have other 3rd party components installed that possibly interfere with the graphics format registered for TDGIPPicture
  2. TAdvMetroButton is designed to render monochrome images in different colors (for different button states). If you use non monochrome pictures, this might lead to bad results. If you need color images, we recommend to use a control like TAdvGlowButton.

Hi Bruno,
I use Metrobutton for many years with monochrome picture.
Please check the little demo attached to this mail. Perhaps helps to reproduce my problem.
On Delphi 11.1 (update 1) and latest TMS-Version not works, while con Delphi 10.3 (Update3) works fine
I have also activated Devexpress and Reportbuilder-Components but I don’t think they interfere with your components…

In any case they are indifferently also on Delphi 10.3, so I suggest they do not matter.

By the way TADVGlowButton does the same message on Designtime trying to load Attach.png (s.2.attach) (1.8 KB)

So, what exact problem do you have with TAdvMetroButton? Do you mean you see this error "invalid graphic format" also with the TAdvMetroButton project? I retested this here on Delphi 11.1 but I could not see this problem.
Also for TAdvGlowButton, I can load attach.png as picture for the button at design-time without any error.

I just tried it with Delphi 11.2 now,
first problem loading an image on designtime works correctly now

but unfortunately the second problem remains the same.
I have slightly changed the demo so you can see better what`s the problem: (1.3 MB)

  1. open Project2.exe

  2. first form displays fine

  3. click on Button1 to open second form

  4. this form comes with wrong background on Metrobutton:

Hi Bruno,
were you able to reproduce the problem above ?

I could not reproduce this here so far with the latest TMS VCL UI Pack version.
I tested this on Windows 10 and Windows 11 and tested with Delphi 10.2 as well as Delphi 11.2

Hi Bruno,
seems to be related to remote sessions:
on standalone pc works indeed fine, but try to open the sample application inside a remote desktop session.
there you will see the problem i suppose.
does not works neither with citrix nor mstsc

my client + server have both windows10 installed

I have finally found the cause of the dysfunction:
with DoubleBuffered =false does not work correctly. setting DoubleBuffered =True fix the problem.

I normally set the property to True,
but it seems that Delphi 11 (or something else?) automatically sets this property to False in RemoteSession environments, which causes the problem in question.

Unfortunately you can change Doublebuffered itself because is remains always false on remotesessions.
but I found this fix inside TADVCustomMetroButton.WMPaint in the meanwhile:

FDoubleBuffered := true; //<<===

if not FDoubleBuffered or (Message.DC <> 0) then
DC := GetDC(0);

but know that with DoubledBuffered=False there are some other problems in your Library:

e.g. the ADVOfficePager flickers with tabsheets aligned on the left side as soon as you move the mouse over it.