{$reference 'System.Windows.Forms.dll'}
{$reference 'System.Drawing.dll'}
uses System, System.Windows.Forms;
var
f : Form;
btn : Button;
procedure ButtonClick(sender: object; e: EventArgs);
begin
MessageBox.Show('Hello world!');
end;
begin
f := new Form;
var w := f.Width;
var h := f.Height;
btn := new Button;
btn.Left := integer((f.Width - btn.Width)/2);
btn.Top := integer((f.Height - btn.Height)/2)-10;
btn.Text := 'Click me';
btn.Click += ButtonClick;
f.Controls.Add(btn);
Application.Run(f);
end.
|