K
killerc
Unregistered / Unconfirmed
GUEST, unregistred user!
1213: 我把你的代码稍作了修改
var
flag:boolean;
sx,sy,oldx,oldy:integer;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
flag:=True;
sx:=x;
sy:=y;
canvas.MoveTo(sx,sy);
canvas.Pen.Mode:=pmnotxor;
oldx := x;
oldy := y;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if not flag then exit;
//擦除原线
canvas.MoveTo(sx, sy);
canvas.LineTo(oldx,oldy);
//画新线
oldx:=x;
oldy:=y;
canvas.MoveTo(sx,sy);
canvas.LineTo(oldx,oldy);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
flag:=false;
end;
var
flag:boolean;
sx,sy,oldx,oldy:integer;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
flag:=True;
sx:=x;
sy:=y;
canvas.MoveTo(sx,sy);
canvas.Pen.Mode:=pmnotxor;
oldx := x;
oldy := y;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if not flag then exit;
//擦除原线
canvas.MoveTo(sx, sy);
canvas.LineTo(oldx,oldy);
//画新线
oldx:=x;
oldy:=y;
canvas.MoveTo(sx,sy);
canvas.LineTo(oldx,oldy);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
flag:=false;
end;