?? contor.~pas
字號(hào):
unit contor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure cantor(ax :real;ay : real; bx :real; by :real);
var
c: Integer; //c 為判斷小量,當(dāng)(bx - ax) < c 時(shí),堆棧釋放
d : Integer; //d為兩層線段之間的距離
cx,cy,dx,dy :real;
begin
c := 1;
d := 20;
If (bx - ax) < c Then
begin
Form1.Canvas.MoveTo(Round(ax),Round(ay));
Form1.Canvas.LineTo(Round(bx),Round(by));
end
Else
begin
Form1.Canvas.MoveTo(Round(ax),Round(ay));
Form1.Canvas.LineTo(Round(bx),Round(by));
cx := ax + (bx - ax) / 3;
cy := ay + d;
dx := bx - (bx - ax) / 3;
dy := by + d;
ay := ay + d;
by := by + d;
cantor(ax, ay, cx, cy);
cantor(dx, dy, bx, by);
end;
End;
procedure TForm1.Button1Click(Sender: TObject);
begin
cantor(100, 40, 500, 40);
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -