Sign in Join
FPDoc Onlineexperiment

TCustomForm.WMDPIChanged procedure

Member of TCustomFormprotectedIn unit Forms

Handles the LM_DPICHANGED window message for the form.

Declaration

pascal
procedure WMDPIChanged(var Msg: TLMessage); message

Arguments

Msg

Window message handled in the method.

Description

Calls AutoAdjustLayout to apply the DPI setting in Message. This action is performed when:

  • The Parent for the form has not been assigned.
  • Scaled is enabled for both the Application and the form instance.
  • The DPI setting in Message is different than the PixelsPerInch value for the form.
Problem (Windows): if the form is shown the first time on a secondary monitor with a different DPI settings, the WM_DPICHANGED message is sent within UpdateBounds when BoundsLockCount>0 which means the bounds are not scaled. We force to update the bounds. See issue 32162. (A better solution is welcome.)

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.