View Issue Details

IDProjectCategoryView StatusLast Update
0018233LazarusOtherpublic2011-09-20 03:53
Reporterlainz Assigned ToJuha Manninen  
Status closedResolutionno change required 
Product Version0.9.29 (SVN) 
Summary0018233: ScaleDPI: unit for making Windows 7 High DPI Applications
DescriptionThis is a procedure like ScaleBy to scale Forms and Controls position and size, it uses ScaleX and ScaleY ( because those functions reads the system DPI configuration, so the scaling is relative to DPI and works for making Windows 7 High DPI Applications.

Just a procedure ScaleControl(Control: TControl; FromDPI: Integer);

Download and compile the attached file, it contains the scaledpi.pas with the procedure ScaleControl, the project file show how to use the procedure :)

To test if it works change your screen DPI in the Control Panel (additional information how to change your screen DPI at the first msdn link ^^)
Additional InformationIn a Form the "FromDPI" value must be defined by the designer (i wish a property in the Object Inspector "FromDPI" or "DesignedDPI" and call ScaleControl when the form is being created automatically :).

  FromDPI=96; // if you designed the form at 96 dpi (100%).

{ FromDPI=144; if you designed the form at 144 dpi (150%): the procedure scale down the size of the form and controls if you are running in a lower dpi }

then OnCreate event:

if FromDPI <> Screen.PixelsPerInch then begin

This unit uses some code used in ScaleBy ( to recursively scale controls inside TPanel and other controls.
TagsHighDPI, scale
Fixed in Revision
Attached Files


related to 0017250 closedPaul Ishenin [PATCH] Add ScaleBy and ChangeScale to LCL 
related to 0020244 closedJuha Manninen Lazarus GUI issues in Windows running in High DPI 


2010-12-16 20:35 (97,152 bytes)

Vincent Snijders

2010-12-17 09:13

manager   ~0044290

Last edited: 2010-12-17 09:14

Thank you for the example how to use the Scaling in Windows 7.

Why did you create this feature request? Feel free to add this example to the wiki.

Do you want to change something in Lazarus IDE or the LCL?


2011-08-22 21:09

reporter   ~0051032


>>Do you want to change something in Lazarus IDE or the LCL?

If possible make Lazarus IDE High DPI aware application for Windows.

Juha Manninen

2011-09-19 10:00

developer   ~0052015

Lazarus behaves now better with High DPI. See related issues.

Issue History

Date Modified Username Field Change
2010-12-16 20:35 lainz New Issue
2010-12-16 20:35 lainz File Added:
2010-12-16 20:35 lainz Widgetset => Win32/Win64
2010-12-17 03:54 lainz Tag Attached: scale
2010-12-17 09:08 Vincent Snijders LazTarget => -
2010-12-17 09:08 Vincent Snijders Status new => acknowledged
2010-12-17 09:08 Vincent Snijders Relationship added related to 0017250
2010-12-17 09:13 Vincent Snijders Note Added: 0044290
2010-12-17 09:13 Vincent Snijders Status acknowledged => feedback
2010-12-17 09:14 Vincent Snijders Note Edited: 0044290
2011-06-28 15:39 lainz Tag Attached: HighDPI
2011-08-22 21:09 lainz Note Added: 0051032
2011-09-19 09:55 Juha Manninen Relationship added related to 0020244
2011-09-19 10:00 Juha Manninen Status feedback => resolved
2011-09-19 10:00 Juha Manninen Resolution open => no change required
2011-09-19 10:00 Juha Manninen Assigned To => Juha Manninen
2011-09-19 10:00 Juha Manninen Note Added: 0052015
2011-09-20 03:53 lainz Status resolved => closed