LineDDA的一个例子
2006-02-04 13:56:15 来源:WEB开发网核心提示:unit Unit1; interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, ExtCtrls, StdCtrls, Buttons;typeTfmMain = class(TFor
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TfmMain = class(TForm)
PRocedure FormPaint(Sender: TObject);
end;
var
fmMain: TfmMain;
A: Byte;
implementation
uses math;
{$R *.dfm}
procedure c(X,Y:Integer; ACanvas:TCanvas);stdcall;
begin
Inc(A,2);
ACanvas.Pen.Width := 5;
if Odd(A mod 31) then
ACanvas.Pen.Color := clWhite
else
ACanvas.Pen.Color := clBlack;
ACanvas.MoveTo(x,y);
ACanvas.LineTo(x,y);
end;
procedure TfmMain.FormPaint(Sender: TObject);
begin
LineDDA(0,20,width,20,@c,LongInt(Canvas));
LineDDA(0,0,width,Height,@c,LongInt(Canvas));
end;
end.
更多精彩
赞助商链接