Delphi 鼠标画图,根据鼠标走过的轨迹画出任意形状的线

来源:百度知道 编辑:UC知道 时间:2024/05/31 12:13:31
实现的功能就和系统自带的画图工具的铅笔的功能类似。

canvas 就可以画

楼上的就是传说中的百度骗子吧~
见识了~

private
lastpoint:TPoint;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ssleft in Shift then
begin
if (lastpoint.x=0) and (lastpoint.y=0) then
begin
LastPoint.X:=x;
LastPoint.Y := y;
end;
Canvas.MoveTo(lastpoint.x, lastpoint.y);
Canvas.LineTo(X, Y);
LastPoint.x:=X;
LastPoint.Y:=y;
end;
end;