Auto-sized checkboxes/radiobuttons with non-default font size are too high when Windows system font size is increased
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-378-g05970c6b) FPC 3.3.1 i386-win32-win32/win64
- Operating System: Windows 10 or other versions; not clear whether other widgetsets are affected as well.
- CPU / Bitness: 32 and 64 bit
This report is based on forum discussion https://forum.lazarus.freepascal.org/index.php/topic,56418.0.html.
In Windows 10 the system font size can be increased by a given percentage in the "Ease-of-access" dialog of the system settings. In older versions the same effect can be achieved by changing the menu font. Since Lazarus uses the system font size whenever a Font.Size is specified as zero, LCL programs are affected by this change. However, when a Font.Size is non-zero its height does not change when the Ease-of-Access magnification is modified.
However, this does not work correctly for
TRadiobutton. The attached project contains these controls, as well as a
TCheckGroup and a
TRadiogroup. All these controls are auto-sized, i.e. their
AutoSize property is
Font.Size of the form is changed to 9, and based on the
ParentFont mechanism this propagates to all controls on this form.
- In the default Ease-of-Access setting of 100%, the
Heightof 19 pixels, left screenshot 100-percent.png.
- When the Ease-of-Access magnification is increased to 225%, right screenshot 225-percent.png, the text size does not change as expected because the font size of the controls is non-zero. But the height of the entire
TRadiobuttoncontrols increases up to the value of 41 pixels. The corresponding groupboxes look too widely populated; there is no way to change this when the controls are auto-sized.
This behaviour is not expected and not observed for other controls (e.g. a
TLabel or a
TCombobox). Moreover, it is not observed in Delphi either. There seems to be an issue in auto-sizing of
What did you expect
When the Ease-of-Access magnification factor is changed, the
TRadioButton should stay constant provided that their
Font.Size is non-zero.
Steps to reproduce
Go to Windows system settings, page "Ease of Access", there is a slider "Increase text size". Move it to the right (225%) and click "Apply". Start Lazarus and load the attached project which has
Font.Size 9 on all controls. Note that the
Height of the checkboxes/radiobuttons increases while the text size itself remains unchanged.
Note that Lazarus must be restarted whenever "Ease of Access" is changed.