unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 =
class(TForm)
Button1: TButton;
Panel2: TPanel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button2Click(Sender: TObject);
private { Private-Deklarationen }
pan : TPanel;
public { Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
pan :=
nil
end;
procedure TForm2.FormDestroy(Sender: TObject);
begin
pan.free;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
pan := TPanel.Create(Self);
pan.Parent := Self;
pan.
Name := '
Panel1';
// nur für Demo
pan.Left := 10;
pan.Top := 10;
pan.Width := 100;
pan.Height := 100;
pan.Color := clRed;
// bewirkt nichts !!!!!!
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
Panel2.Color := clBlue;
end;
end.