unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls,Contnrs;
type
TForm1 = class(TForm)
Panel1: TPanel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure OnButtonClick(Sender: TObject);
end;
var
Form1: TForm1;
Button:TButton;
ButtonList: TList;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Button:=TButton.Create(form1);
Button.parent:=panel1;
Button.Visible:=True;
Button.Caption:='+';
Button.Left:= 100;
Button.Top:= 20;
Button.Width:=100;
Button.Height:=100;
Button.OnClick:=Form1.OnButtonClick;
end;
procedure TForm1.OnButtonClick(Sender: TObject);
begin
if Sender is TButton then
with (Sender as TButton) do
panel1.Height:=panel1.Height*2;
end;
end.