Unit1.pas
上传用户:oumai21
上传日期:2016-04-20
资源大小:7k
文件大小:1k
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls;
- type
- TmainForm = class(TForm)
- imgmain: TImage;
- procedure FormActivate(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- FDrawing: Boolean;
- FDesktopBits: TBitmap;
- procedure GrabScreenImage;
- public
- { Public declarations }
- end;
- var
- mainForm: TmainForm;
- implementation
- {$R *.dfm}
- uses ScreenCanvas;
- procedure TMainForm.GrabScreenImage;
- begin
- with FDesktopBits do
- begin
- width := clientwidth;
- height := clientheight;
- end;
- with TScreenCanvas.Create do
- try
- BitBlt(FDesktopBits.Canvas.Handle, 0, 0, clientwidth,
- clientheight, Handle, 0, 0, SRCCOPY);
- imgMain.Picture.Bitmap.Assign(FDesktopBits);
- finally
- Free;
- end;
- end;
- procedure TmainForm.FormActivate(Sender: TObject);
- begin
- GrabScreenImage;
- end;
- procedure TmainForm.FormCreate(Sender: TObject);
- begin
- FDrawing := false;
- FDesktopBits := TBitmap.Create;
- end;
- end.