![]() |
Canvas als Grafik speichern
Hi, so könnt ihr ein Canvas, auf das ihr beispielsweise mit Rectangle & Co. gezeichnet habt, als Grafik abspeichern:
Delphi-Quellcode:
Aufgerufen wird die Prozedur folgendermaßen:
procedure SaveCanvas(SaveCanvas: TCanvas; FileName: string);
var Bmp: TBitmap; MyRect: TRect; begin Bmp:= TBitmap.Create; try MyRect := SaveCanvas.ClipRect; Bmp.Width := MyRect.Right - MyRect.Left; Bmp.Height := MyRect.Bottom - MyRect.Top; Bmp.Canvas.CopyRect(MyRect, SaveCanvas, MyRect); Bmp.SaveToFile(FileName); finally FreeAndNil(Bmp); end; end;
Delphi-Quellcode:
SaveCanvas(PaintBox1.Canvas, 'D:\Canvas von PaintBox1.bmp');
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:37 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz