Einzelnen Beitrag anzeigen

Benutzerbild von mikhal
mikhal

Registriert seit: 11. Sep 2003
Ort: Linz am Rhein
796 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Fit image in control

  Alt 1. Feb 2017, 14:45
Could be a rounding error. Try another formula:

Result.Width := Round(AMediaWidth * AControlHeight / AMediaHeight);
and
Result.Height := Round(AMediaHeight * AControlWidth / AMediaWidth);
Your Version defines a small result in your term to round, leading to a possible inaccuracy with your following multipication.

Second: Round uses Banker's Rounding. If your term to round is in the middle of two numbers it will give you the even number.

Gretings
Mikhal
Michael Kraemer
Computer erleichtern die Arbeit...
...und die Erde ist eine Scheibe!
  Mit Zitat antworten Zitat