打印本文 打印本文 关闭窗口 关闭窗口
LineDDA的一个例子
作者:武汉SEO闵涛  文章来源:敏韬网  点击数594  更新时间:2009/4/23 18:28:16  文章录入:mintao  责任编辑:mintao
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.

打印本文 打印本文 关闭窗口 关闭窗口