Einzelnen Beitrag anzeigen

Reinhold
(Gast)

n/a Beiträge
 
#4

Re: Problem mit Stretchdraw/SaveToFile (Erstellt 0 KB Dateie

  Alt 29. Mai 2006, 16:12
Hallo,

vieleicht hilft Dir dieser Code, zur Ermittlung der neuen Größe.

Delphi-Quellcode:
function DestRect(DestWidth, DestHeight, SourceWidth, SourceHeight: Integer;
         Center: Boolean): TRect;
var
  cw, ch, w, h: Integer;
  xyaspect: Double;
begin
  cw := DestWidth;
  ch := DestHeight;
  w := SourceWidth;
  h := SourceHeight;

  xyaspect := w / h;
  if w > h then begin
    w := cw;
    h := Trunc(cw / xyaspect);
    if h > ch then begin
      h := ch;
      w := Trunc(cw * xyaspect);
    end
  end else begin
    h := ch;
    w := Trunc(ch * xyaspect);
    if w > cw then begin
      w := cw;
      h := Trunc(ch / xyaspect);
    end
  end;

  with Result do begin
    Left := 0;
    Top := 0;
    Right := w;
    Bottom := h;
  end;

  if Center then
    OffsetRect(Result, (cw - w) div 2, (ch - h) div 2);
end;
Gruß Reinhold
  Mit Zitat antworten Zitat