Trying to change dimensions of my FMX form to emulate a 'FullScreen' mode, but using the Screen size backfires when a user has its settings with some bigger scaling, since the whole form becomes bigger than the screen.
How can I retrieve the scaling value so I can Size the form accordingly?
EDIT: That's a little snippet that shows what was my intention with the question and how it was solved. Thank you for you time and help.
procedure TMyForm.ApplyFullScreen;
var
tmpEscale: Extended;
begin
BorderStyle := TFmxFormBorderStyle.None;
Left := 0;
Top := 0;
tmpEscala := USER_DEFAULT_SCREEN_DPI / GetDeviceCaps(GetDC(0), LOGPIXELSX);
Height := Round(Screen.Height * tmpEscala);
Width := Round(Screen.Width * tmpEscala);
end;
When you call EnumDisplaySettings
the resulting DEVMODE
structure contains the DPI setting in the dmYResolution
field. Beware that passing NULL
as the device name to EnumDisplaySettings
will get the information only for one screen, on a multimonitor system you should enumerate all the display devices.
You can also call GetDeviceCaps
on a device context, and query for LOGPIXELSX
and LOGPIXELSY
.
The DPI corresponds to font scaling as follows:
For more information, it would be good to refer to the MSDN article on DPI-related APIs