unit uTanne;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Hoehe: TEdit;
    Zeichne: TButton;
    Zeichnung: TLabel;
    Ende: TButton;
    Reset: TButton;
    procedure ZeichneClick(Sender: TObject);
    procedure EndeClick(Sender: TObject);
    procedure ResetClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ZeichneClick(Sender: TObject);
var h, i, z : integer;
    t,st : string;
begin
  h := strtoint(Hoehe.Text);
  Hoehe.visible := true;
  zeichnung.visible := true;
  t := '';
  for z := 0 to h-1 do
    begin
      for i := 1 to h-z do
        t := t + ' ';
      for i := 1 to 2*z+1 do
        t := t + '*';
      t := t +#13;
      Zeichnung.Caption :=t;
    end;
  t := '*';
  for i := 1 to h do
     t := ' ' + t;
  Zeichnung.Caption := Zeichnung.caption  +t + #13 +t;

end;

procedure TForm1.EndeClick(Sender: TObject);
begin
   close;
end;

procedure TForm1.ResetClick(Sender: TObject);
begin
   Zeichnung.Caption := '';
   Hoehe.visible := true;
   Hoehe.Text := '0';
   Hoehe.setfocus;
end;

end.
