delphidelphi-12-athens

How Do I Make Toolbar Icons the Same Size When the App Runs in Delphi


I don't understand why the toolbar icons while in development environment (RAD Studio) are larger than when the application actual runs.

From the Development Environment:

enter image description here

From when the application runs (the icons are smaller):

enter image description here

Each of the icons are set with a width of 22 and a height of 23. The toolbar button width and height values are the same (22x23 respectively). By changing the forms scaling true or false makes no difference. The development environment is executed with the option "/highdpi:unaware".

Any ideas or other suggestions would be greatly appreciated. Thanks.


Solution

  • Standard TImageList does not support scaling of its icons in HiDPI environment. But you can replace it with TVirtualImageList + TImageCollection combo. These components can scale their icons depending on current DPI and even select from multiple icons with different sizes.