刚才写错了,应该是pmxor;你可以试一下下面的:
var
flag:boolean;
sx,sy,oldx,oldy:integer;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
flag:=True;
sx:=0;
sy:=0;
oldx:=x;
oldy:=y;
canvas.MoveTo(sx,sy);
canvas.Pen.Mode:=pmnotxor;
canvas.LineTo(oldx,oldy);
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;
canvas.MoveTo(sx,sy);
canvas.LineTo(oldx,oldy);
end;