unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> procedure ButtonClick(Sender: TObject);<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br>Procedure TForm1.ButtonClick(sender: TObject);<br>begin<br> ShowMessage('Button is clicked');<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> AForm: TForm;<br> AButton: TButton;<br> AImage: TImage;<br>begin<br> AForm := TForm.Create(Application);<br> AButton:=TButton.Create(AForm);<br> AButton.left:=20;<br> AButton.Top:=20;<br> AButton.Caption := 'Try Me';<br> AButton.OnClick := ButtonClick;<br> AButton.parent:=AForm;<br> AImage := TImage.Create(AForm);<br> AImage.Left := 20;<br> AImage.Top := AButton.Top+Abutton.Height + 10;<br> AImage.LoadFromFile('c:/Windows/bubbles.bmp');<br> AImage.Parent:=AForm;<br> AForm.Show;<br>end;<br><br>end.<br>