unit Haus1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

const
  FMax = 16;
  Farbe: Array[0..FMax-1] of TColor =
   (clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
    clOlive, clGray, clSilver, clRed, clLime, clBlue,
    clAqua, clFuchsia, clYellow, clWhite);
  
var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer; Mfarbe: TColor;
begin
  // Farben anrühren
  Canvas.Pen.Color := Farbe[random(FMax)];
  repeat
    Mfarbe := Farbe[random(FMax)];
  until (Mfarbe <> clAqua) and (Mfarbe <> clSilver);
  Canvas.Brush.Color := Mfarbe;
  // Zeichnen
  Canvas.MoveTo (50, 100);
  Canvas.LineTo (ClientWidth div 2, 20);
  Canvas.LineTo (ClientWidth-50, 100);
  Canvas.Rectangle (50,100, ClientWidth-50, ClientHeight-20);
  // Malen
  Canvas.Brush.Color := Farbe[random(FMax)];
  Canvas.FloodFill (ClientWidth div 2, 50, Canvas.Pen.Color,fsBorder);
  // Fenster
  Canvas.Brush.Color := clAqua;
  Canvas.Rectangle (ClientWidth div 2, 150, ClientWidth-100, ClientHeight-70);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  randomize;
end;

end.
