unit Unit1 interface uses Windows Messages SysUtils Variants Classes G

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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.