Unit1.pas
资源名称:SimpleSC.rar [点击查看]
上传用户:juxian
上传日期:2013-04-01
资源大小:38k
文件大小:1k
源码类别:
驱动编程
开发平台:
Delphi
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ScrSpy;
- type
- TForm1 = class(TForm)
- ScreenSpy1: TScreenSpy;
- procedure FormResize(Sender: TObject);
- procedure ScreenSpy1ScreenBitmap(Sender: TObject;
- const Block: TScreenBlock; LastScanline: Pointer; IsIFrame: Boolean);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- XRate, YRate: Extended;
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.DFM}
- procedure TForm1.FormResize(Sender: TObject);
- begin
- XRate:= ClientWidth / ScreenSpy1.ScreenWidth;
- YRate:= ClientHeight / ScreenSpy1.ScreenHeight;
- end;
- procedure TForm1.ScreenSpy1ScreenBitmap(Sender: TObject;
- const Block: TScreenBlock; LastScanline: Pointer; IsIFrame: Boolean);
- Var
- R: TRect;
- begin
- R:= Rect(Round(Block.Bound.Left*XRate), Round(Block.Bound.Top*YRate), Round(Block.Bound.Right*XRate), Round(Block.Bound.Bottom*YRate));
- Canvas.StretchDraw(R, Block.BMP);
- end;
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- ScreenSpy1.Active:= False;
- end;
- end.