FAQ по Windows Forms: различия между версиями
Материал из Вики проекта PascalABC.NET
Перейти к навигацииПерейти к поиску
Нет описания правки |
Mikst (обсуждение | вклад) Нет описания правки |
||
Строка 1: | Строка 1: | ||
* Минимальная программа на PascalABC.NET, создающая форму | * Минимальная программа на PascalABC.NET, создающая форму | ||
{$reference 'System.Windows.Forms.dll'} | |||
{$reference 'System.Drawing.dll'} | |||
uses System, System.Windows.Forms; | uses System, System.Windows.Forms; | ||
Строка 15: | Строка 15: | ||
* Как добавить кнопку на форму и вывести по ее нажатии сообщение? | * Как добавить кнопку на форму и вывести по ее нажатии сообщение? | ||
{$reference 'System.Windows.Forms.dll'} | |||
{$reference 'System.Drawing.dll'} | |||
uses System, System.Windows.Forms; | uses System, System.Windows.Forms; |
Текущая версия от 01:48, 28 января 2019
- Минимальная программа на PascalABC.NET, создающая форму
{$reference 'System.Windows.Forms.dll'} {$reference 'System.Drawing.dll'}
uses System, System.Windows.Forms; var f : Form; begin f := new Form; Application.Run(f); end.
- Как добавить кнопку на форму и вывести по ее нажатии сообщение?
{$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; btn := new Button; btn.Text := 'Click me'; btn.Click += ButtonClick; f.Controls.Add(btn); Application.Run(f); end.