FAQ по Windows Forms: различия между версиями

Материал из Вики проекта PascalABC.NET
Перейти к навигацииПерейти к поиску
(Новая: Минимальная программа на PascalABC.NET, создающая форму #reference 'System.Windows.Forms.dll' #reference 'System.Drawing.dll' uses System, Syste...)
 
Нет описания правки
Строка 1: Строка 1:
Минимальная программа на PascalABC.NET, создающая форму
* Минимальная программа на PascalABC.NET, создающая форму


  #reference 'System.Windows.Forms.dll'
  #reference 'System.Windows.Forms.dll'
Строка 10: Строка 10:
  begin
  begin
   f := new Form;
   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);
   Application.Run(f);
  end.
  end.

Версия от 15:55, 28 июня 2009

  • Минимальная программа на 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.