Create image from Form/de
Deutsch · English
Für die Beispiele werden folgende Units benötigt:
...
uses
Graphics, Controls, Clipbrd, Forms, ...
...Die Funktion erstellt vom übergebenen Formular einen Bildschirmausdruck (Screenshot).
...
uses
Forms, Graphics, Controls, ...
...
Procedure subErstelleFormularImage(Formular: TForm; out Bitmap: TBitmap);
var
Breite: Integer;
Hoehe: Integer;
Rechteck: TRect;
begin
Breite := Formular.Width;
Hoehe := Formular.Height;
Rechteck := Rect(0, 0, Breite, Hoehe);
Bitmap.Width := Breite;
Bitmap.Height := Hoehe;
Bitmap.Canvas.CopyRect(Rechteck, Formular.Canvas, Rechteck);
end;Demonstration, wie z. B. die obige Funktion verwendet werden kann.
...
uses
Clipbrd, ...;
...
procedure Test;
var
Bitmap: TBitMap;
begin
...
// Fordert den Speicher für die Bitmap an
Bitmap := TBitmap.Create;
// Ruft die Funktion zum erstellen des Bildschirmausdrucks / Screenshots auf
subErstelleFormularImage(Form1, Bitmap);
// Beispiel 1: Weist den Screenschot einem Image zu
image1.Picture.Assign(Bitmap);
// Beispiel 2: Weist den Screenschot der Zwischenablage zu
Clipboard.Assign(Bitmap);
// Gibt den Speicher der Bitmap frei
FreeAndNil(Bitmap)
...
end;
...From the Free Pascal wiki, page "Create image from Form/de", as it stood on 2020-02-12 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.