Images in Toolbar buttons do not scale
Original Reporter info from Mantis: mtrsoft
-
Reporter name: John Raycheba
Original Reporter info from Mantis: mtrsoft
- Reporter name: John Raycheba
Description:
On a Windows 7/32 system and Lazarus 2.0.2 (and probably 2.0)
When a program containing a toolbar and toolbuttons on a system with a screen resolution of 96 PPI is run on a system with a screen resolution of 144 PPI the toolbar and toolbuttons scale properly, but the toolbutton images do not.
Steps to reproduce:
On a Windows 7/32 system with its screen resolution set to 100% (i.e. 96 PPI):
-
Create a new project with one form that contains a toolbar and several tool buttons.
-
Set the toolbutton imageswith to 16
-
Add an imagelist that contains several image resolutions, say, 16x16, 24x24, 32x32, 48x48 and 64x64.
-
Assign images from the imagelist to the toolbuttons using the toolbuttons' imageindex. (Note: the display of the images in the images picklist is less than optimal.)
-
Compile and run the program.
-
Copy the program .exe file to a system that has its screen resolution set to 150% (144 PPI) and run it.
-
Note that the height of the toolbar and toolbuttons will be scaled BUT the images in the toolbuttons will not be scaled.
Additional information:
A QUICK AND DIRTY FIX:
In file C:\Lazarus\LCL\include\ToolBar.inc (line 377 or so)
change
if ButtonWidthIsStored then
ButtonWidth := Round(ButtonWidth * AXProportion);
to
if ButtonWidthIsStored then
begin //JR: added imageswidth scaling
ButtonWidth := Round(ButtonWidth * AXProportion);
ImagesWidth := Round(ImagesWidth * AXProportion);
{
JR: The ImagesWidth should probably be scaled in the same way as the ButtonWidth, etc. That is, by using
FRealizedImagesWidth, ImagesWidthIsStored procedure and cDefImagesWidth none of which currently exist in Toolbar.inc.
}
end;
Mantis conversion info:
- Mantis ID: 35430
- OS: Windows
- OS Build: 7
- Version: 2.0.2