拖的时候自己画个虚线矩形!
1. 橡皮线功能
implementation
{$R *.DFM}
var
drawing:Boolean=false;
oPoint,sPoint:TPoint;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
spoint:=Point(x,y);
opoint:=sPoint;
drawing:=true;
Canvas.Brush.Style := bsclear;
Canvas.Pen.Style := psDot;
Canvas.Pen.Mode :=pmNotXor;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if not(drawing) then exit;
canvas.Ellipse(spoint.x,spoint.y,opoint.x,opoint.y);
canvas.Ellipse(spoint.x,spoint.y,x,y);
oPoint:=point(x,y);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if not(drawing) then exit;
canvas.Ellipse(spoint.x,spoint.y,opoint.x,opoint.y);
Canvas.Pen.Style := psSolid;
canvas.Ellipse(spoint.x,spoint.y,x,y);
Drawing:=false;
end;
end.