AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Wie man das Handle von einem Screenshot entfernt
Thema durchsuchen
Ansicht
Themen-Optionen

Wie man das Handle von einem Screenshot entfernt

Ein Thema von victorlus · begonnen am 9. Feb 2018 · letzter Beitrag vom 9. Feb 2018
 
victorlus

Registriert seit: 6. Feb 2018
16 Beiträge
 
#14

AW: Wie man das Handle von einem Screenshot entfernt

  Alt 9. Feb 2018, 16:59
You can get a Hardcopy using Method GetFormImage from TForm.

http://docwiki.embarcadero.com/CodeE...mImage_(Delphi)
Zitat von GetFormImage:
Description

This example uses an image, a button, and a shape component on a form. When you click the button, an image of the form is stored in the FormImage variable and copied to the Clipboard. The image of the form is then copied back to the image component, producing an interesting result, especially if the button is clicked multiple times. Add ExtCtrls, StdCtrls, and Clipbrd to the uses clause.
Delphi-Quellcode:
procedure HardCopy(sJpegFile : String; fm : TForm);
Var
          FStream : TStream;
          FBmp : TPicture;
          FJpeg : TJpegImage;
begin
  if SysUtils.FileExists(sJpegFile) then SysUtils.DeleteFile(sJpegFile);
  FStream := TFileStream.Create(sJpegFile,fmCreate);
  fm.WindowState := wsNormal;
  fm.Show;
  fm.Refresh;
  FJpeg := TJpegImage.Create;
  FBmp := TPicture.Create;
  try
    FBmp.Bitmap.Assign(fm.GetFormImage); // <- get a Hardcopy from TForm
    FJpeg.Assign(FBmp.Bitmap);
    FJpeg.SaveToStream(FStream);
  finally
    FStream.Free;
    FJpeg.Free;
    FBmp.Free;
  end;
end;
Not tested:
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,
  Clipbrd;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    ScrollBox1: TScrollBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure ScreenShot(DestBitmap: TBitmap; fm : TFrom);
begin
  DestBitmap.Assign(fm.GetFormImage); // <- get a Hardcopy from TForm
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ScreenShot(Image1.Picture.Bitmap; Form1); // <-- or any other TForm
end;

end.

Do not work I need to take photo behind the form

Thank you for trying to help me.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:47 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