Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Do 24.09.15 08:19 
Moin Forum,

kann man irgendwie die tatsächliche Auflösung des Monitors in ppi ermitteln?

Wenn ich zum Beispiel das ausführe:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
function Screen_ppi: Integer;
var
  DC: HDC;
begin
  DC := GetDC(GetDesktopWindow);  // Device-Context des Desktops
  try
    Result := GetDeviceCaps(DC, LOGPIXELSX);
  finally
    ReleaseDC(0, DC);
  end;
end;

bekomme ich einen Rückgabewert von 96ppi (Das finde ich auch in der Systemsteuerung).
Das bedeutet doch wenn ich jetzt zum Beispiel ein TPanel mit einer Breite von 960 Pixeln auf meiner Form habe sollte es auf dem Monitor eine Breite von exakt 10 Zoll haben, oder? Tatsächlich sind es allerdings nur 7,55 Zoll. Wenn ich dann mal rückwärts rechne komme ich auf 127ppi.
Kann mir das mal jemand erklären?

Gruß Oliver

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 24.09.15 10:14 
Zitat:
GetDeviceCaps reports info that the display driver provides. If the display driver declines to report any info, GetDeviceCaps calculates the info based on fixed calculations. If the display driver reports invalid info, GetDeviceCaps returns the invalid info. Also, if the display driver declines to report info, GetDeviceCaps might calculate incorrect info because it assumes either fixed DPI (96 DPI) or a fixed size (depending on the info that the display driver did and didn’t provide). Unfortunately, a display driver that is implemented to the Windows Display Driver Model (WDDM) (introduced in Windows Vista) causes GDI to not get the info, so GetDeviceCaps must always calculate the info.

GetDeviceCaps function

Sicherstellen, dass Anwendungen auf Bildschirmen mit hohen DPI-Werten ordnungsgemäß angezeigt werden