Enabling High DPI makes TImage smaller at runtime than at design-time

159 views Asked by At

I have a Form with width 700 and height 500. I put a TImage on it, with Align=alClient and Stretch=True set at design-time.

At run-time, the Image pixels gets blurred. If I set the TImage.Stretch property to False, then at run-time the Image size is shown half of the Form size at the top-left corner. Every Image size gets smaller at run-time than its actual size.

If I disable High DPI then everything works well.

I use Delphi Tokyo. What could be the cause, and how to fix it so I can enable High DPI and all the Image size will remain the same at run-time as at design-time?

1

There are 1 answers

0
Uwe Raabe On

If you enable High DPI, you are responsible for providing images in the proper size/resolution. One option you already tried is the Stretch property of TImage, but that leads to a blurry display.

The correct solution is to use a TImageCollection containing the same image in appropriate sizes, and a TVirtualImage control for the display.

Unfortunately, these two components are not available in Delphi 10.2 Tokyo, so you must either upgrade to a newer version of Delphi, or take care of the image handling yourself.