Reputation: 956
I'm using TImage components in order to display image files. However the pictures look blurry when displayed in high-DPI monitors. If I use high-resolution images, they are stretched in normal monitors and looks bad.
I'm aware Delphi 10.4 has built-in TVirtualImage component. I'm looking for a workaround for Delphi 10.3.3 VCL applications.
Upvotes: 2
Views: 1391
Reputation: 47714
put your image files with different resolutions into a TImageCollection
add a TVirtualImageList
onto your form and set its Width and Height as needed
add that image to the TVirtualImageList
add a method UpdateImage to your form with the following content:
Image1.Picture.Bitmap := nil;
VirtualImageList1.GetBitmap(0, Image1.Picture.Bitmap);
call UpdateImage in the forms OnCreate and OnAfterMonitorDpiChanged handler
Upvotes: 3