Last active
April 7, 2016 17:26
-
-
Save UweRaabe/92021a7c1566b84ba7427a7a0da28fbd to your computer and use it in GitHub Desktop.
Screenshot to Metafile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit Unit77; | |
interface | |
uses | |
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | |
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Actions, Vcl.ActnList; | |
type | |
TForm77 = class(TForm) | |
Button1: TButton; | |
procedure Button1Click(Sender: TObject); | |
private | |
public | |
end; | |
var | |
Form77: TForm77; | |
implementation | |
{$R *.dfm} | |
procedure TForm77.Button1Click(Sender: TObject); | |
var | |
cnv: TMetafileCanvas; | |
emf: TMetafile; | |
notused: HWND; | |
begin | |
emf := TMetafile.Create; | |
try | |
emf.SetSize(ClientWidth, ClientHeight); | |
cnv := TMetafileCanvas.Create(emf, GetDeviceContext(notused)); | |
try | |
Self.PaintTo(cnv, 0, 0); | |
finally | |
cnv.Free; | |
end; | |
emf.SaveToFile('c:\temp\Test.emf'); | |
finally | |
emf.Free; | |
end; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment