![]() |
AW: Low/High DPI zur Laufzeit ändern?
Ab Windows10 1809 gibt es ja UnawareGdiScaled
Das Funktioniert sogar. Alle Schriften sind mit voller Auflösung scharf. Oder auch selbst gemaltes mit GDI+. Ohne jetzt mit viel Aufwand ein ganzes Programm auf PerMonitorAwareV2 zu ändern. Jetzt zum Problem. Das geht nur wenn DoubleBuffered aus ist. Sonst ist es unscharf wie vorher. Also ohne DoubleBuffered und ParentBackground Flackert es. Bekommt man das Flackern auch ohne DoubleBuffered weg? Bei GDI mache ich schon nur Invalidate, dann zeichnet alles in einem rutsch Bei ehr Statischen Programmen ist es OK mit UnawareGdiScaled ein und DoubleBuffered aus. Aber nicht bei einem HMI wo sich viel oft ändert. (Jetzt noch Delphi XE4)
Delphi-Quellcode:
const
Context_Undefined = 0; Context_Unaware = -1; Context_SystemAware = -2; Context_PerMonitorAware = -3; Context_PerMonitorAwareV2 = -4; Context_UnawareGdiScaled = -5; type TSetProcessDPIAwarenessContext = function(value: Integer): HRESULT; stdcall; var setProcessDPIAwarenessContext: TSetProcessDPIAwarenessContext; hd2: THandle; hr: HRESULT; hd2 := LoadLibrary('user32.dll'); if hd2 <> 0 then begin setProcessDPIAwarenessContext := GetProcAddress(hd2, 'SetProcessDpiAwarenessContext'); if Assigned(setProcessDPIAwarenessContext) then begin hr := setProcessDPIAwarenessContext(Context_UnawareGdiScaled); end; FreeLibrary(hd2); end; |
AW: Low/High DPI zur Laufzeit ändern?
So geht es auch bei x64
Code:
{$IFDEF WIN64}
TSetProcessDPIAwarenessContext = function(value: Int64): HRESULT; stdcall; {$ELSE} TSetProcessDPIAwarenessContext = function(value: Integer): HRESULT; stdcall; {$ENDIF} |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz