procedure TForm1.Button1Click(Sender: TObject);
var
Bmp: TBitmap;
R: TRect;
begin
Bmp := TBitmap.Create;
try
R := Rect(0, 0, Width, Height);
Bmp.Width := Width;
Bmp.Height := Height;
Bmp.Canvas.CopyRect(R, Canvas, R);
Bmp.SaveToFile('D:/temp.bmp');
finally
Bmp.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Bmp: TBitmap;
R: TRect;
begin
Bmp := TBitmap.Create;
try
R := Rect(0, 0, Width, Height);
Bmp.LoadFromFile('D:/Photo/32pic02.BMP');
Canvas.CopyRect(R, Bmp.Canvas, R);
finally
Bmp.Free;
end;
end;