(Gast)
n/a Beiträge
|
PaintBox "fixieren"
31. Jan 2003, 00:35
Delphi-Quellcode:
type
TForm1 = class(TForm)
PaintBox1: TPaintBox;
procedure PaintBox1Paint(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private-Deklarationen }
FbmpWork : TBitmap;
procedure SavePaintBox;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.SavePaintBox;
var
rtWork : TRect;
begin
if Assigned(FbmpWork) then
begin
FreeAndNil(FbmpWork);
end;
FbmpWork := TBitmap.Create;
FbmpWork.Width := PaintBox1.Width;
FbmpWork.Height := PaintBox1.Height;
rtWork.Left := 0;
rtWork.Top := 0;
rtWork.Right := FbmpWork.Width;
rtWork.Bottom := FbmpWork.Height;
FbmpWork.Canvas.CopyRect(rtWork,PaintBox1.Canvas,PaintBox1.ClientRect);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
if Assigned(FbmpWork) then
begin
PaintBox1.Canvas.Draw(0,0,FbmpWork);
end;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if Assigned(FbmpWork) then
begin
FreeAndNil(FbmpWork);
end;
end;
Von Christian Seehase!
Grüsse, Daniel
|
|
Zitat
|