Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#8

AW: Resize ohne Dimensions Verlust

  Alt 20. Mär 2017, 07:52
Muste noch was ändern.
Aber so geht's. Supi und nochmals Danke..

Delphi-Quellcode:
var
  TargetRatio: Double;
  IsRelationship: Double;
  w, h, x, y: Single;
begin
  // Gif Zentrieren
  IsRelationship := GifFrameRect.Width / GifFrameRect.Height;
  TargetRatio := rc.Right / rc.Bottom;

  if IsRelationship > TargetRatio then
  begin
    w := rc.Right;
    h := rc.Right / IsRelationship;
  end else
  if IsRelationship < TargetRatio then
  begin
    h := rc.Bottom;
    w := rc.Bottom * IsRelationship;
  end else
  begin
    w := rc.Right;
    h := rc.Bottom;
  end;

  X := (rc.Right - w) / 2;
  Y := (rc.Bottom - h) / 2;
end;
Perfekt!
Unterschied Pics von oben und die hier.

EDIT:
Ich lade das Projekt heute Abend hoch zum testen muss jetzt erst mal in die Kiste.

gruss

Geändert von EWeiss (11. Jul 2019 um 15:47 Uhr)
  Mit Zitat antworten Zitat