Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#12

Re: Compute screen proportion

  Alt 22. Jul 2012, 20:14
I modified @Amateurprofi code to support x:10, changed to return float and wrote format function:

Delphi-Quellcode:
function GetScreenProportion(const AWidth, AHeight: Cardinal): string;
var
  AspectRatio: Single;
  X, Y: Extended;
begin
  AspectRatio := GetScreenAspectRatio(AWidth, AHeight);
  X := Int(AspectRatio);
  Y := Frac(AspectRatio) * 100;

  if Int(Y) <> 10 then
    Y := Y / 10
  ;

  Result := Format('%.0f:%.0f', [X, Y])
end;
Thanks
  Mit Zitat antworten Zitat