Thema: Delphi Dpi --> ppi

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#3

Re: Dpi --> ppi

  Alt 1. Jul 2011, 12:29
I don't know I have this and don't have idea how to compute it

Delphi-Quellcode:
var
  dp, ppi: Int32;
  di: Int32;
begin
  ShowMessage(Format('%dx%d'#13#10'%dx%d'#13#10'%dx%d'#13#10'%dx%d', [
    PrintPreview1.PageSize.X, PrintPreview1.PageSize.Y,
    PrintPreview1.PageDevicePixels.X, PrintPreview1.PageDevicePixels.Y,
    PrintPreview1.PageLogicalPixels.X, PrintPreview1.PageLogicalPixels.Y,
    Printer.PageWidth, Printer.PageHeight
  ]));

  dp := Round(Sqrt(Sqr(PrintPreview1.PageDevicePixels.X) + Sqr(PrintPreview1.PageDevicePixels.Y)));
  di := Round(Sqrt(Sqr(PrintPreview1.PageDevicePixels.X div GetDeviceCaps(PrintPreview1.Printer.Handle, LOGPIXELSX)) + Sqr(PrintPreview1.PageDevicePixels.Y div GetDeviceCaps(PrintPreview1.Printer.Handle, LOGPIXELSY))));
  ppi := dp div di;
  ShowMessage(IntToStr(dp div (dp div 96)));
end;
  Mit Zitat antworten Zitat