unit dreieckU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TForm1 =
class(TForm)
Image1: TImage;
SpeedButton1: TSpeedButton;
procedure dreieck ;
procedure pyramide (a:integer);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.dreieck;
begin
with Image1.Canvas
do
begin
lineTo (penpos.X+10,penpos.Y-10);
lineTo (penpos.X+10,penpos.Y+10);
lineTo (penpos.X-20,penpos.Y);
end;
end;
procedure TForm1.pyramide;
var b:integer;
begin
Image1.Canvas.moveTo (0,Image1.Height-1);
repeat
begin
for b:=1
to a
do
begin
dreieck;
with Image1.Canvas
do
moveTo (penpos.X+20,penpos.Y)
end;
with Image1.Canvas
do
moveTo ((penpos.X-round(a*20))+10,penpos.Y-10);
a:= a-1 ;
end;
until
a>=0
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
pyramide (5)
end;
end.