TMain - Goethe Gymnasium Dortmund
TMain - Goethe Gymnasium Dortmund
TMain - Goethe Gymnasium Dortmund
Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.
YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.
procedure <strong>TMain</strong>.machHintergrundBlau(Sender:TObject);<br />
begin<br />
Main.Color := $00FF0000<br />
end;<br />
procedure <strong>TMain</strong>.bewegeBild(Sender:TObject);<br />
begin<br />
IF (hatBild.Left + hatBild.Width > Main.Width-10) OR<br />
(hatBild.Left < 0) THEN delta := -delta;<br />
hatBild.Left := hatBild.Left + delta<br />
end;<br />
Constructor <strong>TMain</strong>.Create(AOwner: TComponent);<br />
Begin<br />
Inherited Create(AOwner);<br />
{wichtig, damit überhaupt erst einmal ein leeres<br />
Formblatt erzeugt wird.}<br />
SetBounds(100,0,400,150); // left, top, width,<br />
// height von Main<br />
hatButton := TButton.Create(Main);<br />
{Damit steht hatButton in der Komponentenliste des<br />
Formblattes Main}<br />
With hatButton DO BEGIN<br />
Parent := Main; {Damit wird festgelegt, in<br />
welchem Elternfenster der Button erscheint}<br />
SetBounds(150, 40, 150, 70); //innerhalb von Main<br />
Caption := 'Blau';<br />
OnClick := machHintergrundBlau<br />
END;<br />
hatBild := TImage.Create(Main);<br />
hatBild.Picture.LoadFromFile('Dog.ico');<br />
hatBild.AutoSize := True;<br />
hatBild.Parent := Main;<br />
hatTimer := TTimer.Create(Main);<br />
hatTimer.Interval := 10;<br />
hatTimer.OnTimer := bewegeBild;<br />
{Timer sind keine visuellen Objekte, benötigen also<br />
auch keine Parentangabe}<br />
delta := 1;<br />
end; // of <strong>TMain</strong>.FormCreate<br />
end. // of Hauptprogramm<br />
8