Watch, Follow, &
Connect with Us

Please visit our new home

Welcome, Guest
Guest Settings

Thread: High DPI Scaling question

This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Permlink Replies: 0
brent shelton

Posts: 29
Registered: 2/14/09
High DPI Scaling question  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 1, 2016 6:38 AM
I am using Delphi 7 for a legacy application. I compiled a multi monitor high dpi aware .RES file and reference that in my project dpr. My code below handles scaling the form based on the monitor font scaling on form creation and when moving the form between different resolution monitors on a multi monitor system. My forms are all designed at 96 PixelsPerInch. Scaling is False. My development monitors are 1600 X 900. My forms have Arial 9 as the form font. I installed my application at an office remotely on 4 systems. All are Windows 7. Two of the systems looked fine and the other 2 show my screens smaller than what they want. I told them to set Windows to 125% as a temporary fix. Maybe the 2 that looked fine were already at 125%. I am just wondering why 2 systems caused my forms to look small. I have an old laptop with Windows 7 and the screen is 1280 X 800 and it looks fine. On the laptop, I have even tried checking and unchecking the "Use Windows XP style DPI scaling" in Custom DPI Setting and even connected a 1920 X 1080 monitor to the laptop but it still looks fine. Using my code below, can I further scale taking into account the screen width and height along with the DPI?

    procedure WMDpiChanged(var Message: TMessage); message WM_DPICHANGED;
   Form1 : TForm1;
   iOldDPI, iNewDPI : Integer;
procedure TForm1.WMDpiChanged(var Message: TMessage);
  iOldDPI := Self.PixelsPerInch;
  iNewDPI := LOWORD(Message.wParam);
  if iNewDPI <> iOldDPI then begin
    Self.ScaleBy(iNewDPI, iOldDPI);
    Self.PixelsPerInch := iNewDPI;
procedure TForm1.FormCreate(Sender: TObject);
  iOldDPI := 96;
  iNewDPI := Screen.PixelsPerInch;
  if iNewDPI <> iOldDPI then begin
    Self.ScaleBy(iNewDPI, iOldDPI);
    Self.PixelsPerInch := iNewDPI;

Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02