{擦除}Canvas.MoveTo(x1, y1);
Canvas.LineTo(x2, y2);
x2 := X; y2 := y;
{重繪}Canvas.MoveTo(x1, y1);
Canvas.LineTo(x2, y2);
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if f then
begin
{畫出確定的線}Canvas.Pen.Mode := pmCopy;
Canvas.MoveTo(x1, y1);
Canvas.LineTo(x2, y2);
f := not f;
end;
end;
end.
//效果圖: