>画斜线时锯齿不能太大:
您需要处理毛刺算法,我改天找找,N年前做过的,忘记了.
先写一段画线程序:
var
Form1: TForm1;
aa :Boolean;
ss,ee :TPoint;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
aa :=False;
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
aa :=True;
ss :=Point(x,y);
ee :=ss;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if aa then
begin
Canvas.MoveTo(ss.x,ss.y);
Canvas.LineTo(ee.x,ee.y);
Canvas.Pen.Mode :=pmNotXor;
ee :=Point(x,y);
Canvas.MoveTo(ss.x,ss.y);
Canvas.LineTo(ee.x,ee.y);
end;
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if aa then
begin
Canvas.MoveTo(ss.x,ss.y);
Canvas.LineTo(ee.x,ee.y);
Canvas.MoveTo(ss.x,ss.y);
Canvas.LineTo(x,y);
end;
aa :=False;
end;