1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Image1: TImage;
BitBtn1: TBitBtn;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
screencanvas : tcanvas ;
screenhandle : HWND ;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
screencanvas:=TCanvas.Create;
screencanvas.Handle:=GetWindowDC(GetDesktopWindow);
form1.doublebuffered:=true ;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var sourcerect : trect ;
demicote : integer ;
begin
demicote:=100 div 2 ; // zone a zoomer : 60x60
sourcerect.Left :=mouse.cursorPos.X-demicote ;
sourcerect.right :=mouse.cursorPos.X+demicote ;
sourcerect.Top :=mouse.cursorPos.Y-demicote ;
sourcerect.Bottom:=mouse.cursorPos.Y+demicote ;
image1.Canvas.CopyRect(image1.ClientRect, screencanvas, SourceRect);
end ;
end. |
Partager