A
achang
Unregistered / Unconfirmed
GUEST, unregistred user!
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
foreimage: TImage;
backimage: TImage;
procedure FormCreate(Sender: TObject);
//Procedure CopyRect(const Dest: TRect; Canvas: TCanvas; const Source: Trect);
procedure ImageCopy(BoxCenterX, BoxCenterY, BoxSide: Integer);
procedure foreimageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
sSide=30;
dSide=45;
var
msHide: Boolean;
OldX, OldY, NewX, NewY: Integer;
DestRect, SourceRect : TRect;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
msHide:=True;
Canvas.CopyMode:=cmSrcCopy;
end;
procedure TForm1.ImageCopy(BoxCenterX, BoxCenterY, BoxSide: Integer);
begin
with SourceRect do
begin
Left:=BoxCenterX-BoxSide;
Top:=BoxCenterY-BoxSide;
Right:=BoxCenterX+BoxSide;
Bottom:=BoxCenterY+BoxSide;
end;
with DestRect do
begin
Left:=BoxCenterX-dSide;
Top:=BoxCenterY-dSide;
Right:=BoxCenterX+dSide;
Bottom:=BoxCenterY+dSide;
end;
ForeImage.Canvas.CopyRect(DestRect, BackImage.Canvas, SourceRect);
end;
procedure TForm1.foreimageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
NewX:=X;
NewY:=Y;
if msHide then
begin
OldX:=NewX;
OldY:=NewY;
msHide:=False;
ShowCursor(False);
end else
begin
ImageCopy(OldX, OldY, dSide);
end;
ImageCopy(NewX, NewY, sSide);
OldX:=NewX;
OldY:=NewY;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if not msHide then
begin
msHide:=True;
ShowCursor(True);
ImageCopy(OldX, OldY, dSide);
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
foreimage: TImage;
backimage: TImage;
procedure FormCreate(Sender: TObject);
//Procedure CopyRect(const Dest: TRect; Canvas: TCanvas; const Source: Trect);
procedure ImageCopy(BoxCenterX, BoxCenterY, BoxSide: Integer);
procedure foreimageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const
sSide=30;
dSide=45;
var
msHide: Boolean;
OldX, OldY, NewX, NewY: Integer;
DestRect, SourceRect : TRect;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
msHide:=True;
Canvas.CopyMode:=cmSrcCopy;
end;
procedure TForm1.ImageCopy(BoxCenterX, BoxCenterY, BoxSide: Integer);
begin
with SourceRect do
begin
Left:=BoxCenterX-BoxSide;
Top:=BoxCenterY-BoxSide;
Right:=BoxCenterX+BoxSide;
Bottom:=BoxCenterY+BoxSide;
end;
with DestRect do
begin
Left:=BoxCenterX-dSide;
Top:=BoxCenterY-dSide;
Right:=BoxCenterX+dSide;
Bottom:=BoxCenterY+dSide;
end;
ForeImage.Canvas.CopyRect(DestRect, BackImage.Canvas, SourceRect);
end;
procedure TForm1.foreimageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
NewX:=X;
NewY:=Y;
if msHide then
begin
OldX:=NewX;
OldY:=NewY;
msHide:=False;
ShowCursor(False);
end else
begin
ImageCopy(OldX, OldY, dSide);
end;
ImageCopy(NewX, NewY, sSide);
OldX:=NewX;
OldY:=NewY;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if not msHide then
begin
msHide:=True;
ShowCursor(True);
ImageCopy(OldX, OldY, dSide);
end;
end;
end.