Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#6

AW: Bildschirmskalierung - Wie aktuelle Einstellung ermitteln?

  Alt 6. Okt 2017, 21:58
Delphi-Quellcode:
var
  ratio: single;
Delphi-Quellcode:
function GetDPI(nPix: LongInt): LongInt;
var
  DC: HDC;
begin
  if ratio = 0 then
  begin
    DC := GetDC(0);
    ratio := GetDeviceCaps(DC, LOGPIXELSX) / 96.0;
    ReleaseDC(0, DC);
  end;
  result := round(nPix * ratio);
end;
Delphi-Quellcode:
MeineFormWeite := 1000;
MeineFormWeiteDPI := GetDpi(MeineFormWeite);
oder
Delphi-Quellcode:
ButtonWidth := 200;
ButtonHeight := 25;
SetRect(rc, 0, 0, GetDPI(ButtonWidth), GetDPI(ButtonHeight));
bye..

Geändert von EWeiss ( 6. Okt 2017 um 22:04 Uhr)
  Mit Zitat antworten Zitat