wenn die
Jedi's noch nicht verwendet werden, dann doch lieber etwas in der Art s.u. um den Kram draussen zu halten.
Delphi-Quellcode:
private
FPicture:TPicture;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
uses pngimage,jpeg;
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
FPicture:=TPicture.Create;
FPicture.LoadFromFile('C:\Icons\IconCollection\ix_bd_all\128x128\shadow\address_book.png');
end;
procedure TForm2.FormDestroy(Sender: TObject);
begin
FreeAndNil(FPicture);
end;
procedure TForm2.FormPaint(Sender: TObject);
Function Faktor:Double;
begin
Result := ClientWidth / FPicture.Graphic.Width;
if (ClientHeight / FPicture.Graphic.Height) < Result then Result := ClientHeight / FPicture.Graphic.Height;
end;
begin
Canvas.StretchDraw(Rect(Round(ClientWidth - (Faktor * FPicture.Graphic.Width) ) div 2
,Round(ClientHeight - (Faktor * FPicture.Graphic.Height) ) div 2
,ClientWidth - Round(ClientWidth - (Faktor * FPicture.Graphic.Width) ) div 2
,ClientHeight - Round(ClientHeight -(Faktor * FPicture.Graphic.Height) ) div 2
)
,FPicture.Graphic);
end;
procedure TForm2.FormResize(Sender: TObject);
begin
invalidate;
end;