您的位置:首页 > 其它

创建一个有对话框功能的窗口

2009-12-22 19:25 225 查看
在Delphi中打开Demo工程,并为主窗体增加一个TButton控件,创建 Form2对话框的目的是:当单击这个按钮时,可以调出Form2对话框









双击Form1上的Button1按钮控件,在事件处理过程中加入以下程序

Form2.Show;

由于Form1窗体调用Form2窗体,所以必须在Form1的库单元程序中对引用Form2进行说明.

在Unit1的Uses后面加入Form2窗体的库单元名Unit2.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Unit2;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
end;

end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: