Page 1 of 1
Delphi 7 & Windows scaling.
Posted: Mon Mar 06, 2023 8:59 pm
by PhillHS
Hi all,
I'm using Delphi 7 on Windows 10 X64.
I have a 4K monitor, which I have set to a 150% scaling in windows display settings.
Having now integrated CEF4 Delphi into my app I find that it now seems to be ignoring the scaling and running at the native resolution (and screwing up the placement of some of my other components). Is there any way to prevent this.
This also seems to affect the SimpleBrowser2 demo (see attached screenshots).
At design time, scaling works.....
Screenshot 2023-03-06 205512.png
At runtime it doesn't
Screenshot 2023-03-06 205638.png
Cheers.
Phill.
Re: Delphi 7 & Windows scaling.
Posted: Tue Mar 07, 2023 7:14 am
by dilfich
Code: Select all
GlobalCEFApp.AddCustomCommandLine('--force-device-scale-factor', '1');
Is it possible?
Re: Delphi 7 & Windows scaling.
Posted: Tue Mar 07, 2023 8:21 am
by salvadordf
Hi,
Try the command line switch that dilfich gave you in the previous post and read this :
https://github.com/salvadordf/CEF4Delphi/issues/449
Re: Delphi 7 & Windows scaling.
Posted: Tue Mar 07, 2023 9:59 am
by Student
Yes, I noticed it a couple of months ago that since version 108 forced HiDPI.
Who doesn't need HiDPI, you can try to forcibly disable it this way, before call GlobalCEFApp.StartMainProcess
Code: Select all
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
Re: Delphi 7 & Windows scaling.
Posted: Tue Mar 07, 2023 7:15 pm
by PhillHS
Concatinating replies :
dilfich wrote: Tue Mar 07, 2023 7:14 am
Code: Select all
GlobalCEFApp.AddCustomCommandLine('--force-device-scale-factor', '1');
Is it possible?
I tried that and it didn't seem to work
Student wrote: Tue Mar 07, 2023 9:59 am
Yes, I noticed it a couple of months ago that since version 108 forced HiDPI.
Who doesn't need HiDPI, you can try to forcibly disable it this way, before call GlobalCEFApp.StartMainProcess
Code: Select all
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
Delphi 7 doesn't seem to have imports for those functions as they where introduced with more recent versions of windows.....
However I guess I should be able to import them from the correct DLL and give it a try.
What I have found does work is setting the properties for my exe in windows explorer :-
Right click->compatibility tab->Change HiDPI settings button
Then check "overide high dpi scaling behavior" and set it to system in the dropdown.
What supprised me is that it retained those settings when I re-compiled the exe.
Cheers.
Phill.