Unit1.~pas
资源名称:xiaxue.rar [点击查看]
上传用户:oumai21
上传日期:2016-04-20
资源大小:7k
文件大小:1k
源码类别:
屏幕保护
开发平台:
Delphi
- 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;
- FCursorBits, FDesktopBits: TBitmap;
- FCursorPos: TPoint;
- 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;
- FCursorBits := TBitmap.Create;
- FCursorBits.loadfromfile('hammer.bmp');
- FCursorBits.Transparent := true;
- FCursorBits.TransparentMode := tmAuto;
- FDesktopBits := TBitmap.Create;
- end;
- end.