delphi 7编程一个简单问题
来源:百度知道 编辑:UC知道 时间:2024/05/27 09:57:21
基础不太好..请教高手了。。
在“工程”选项里,把你的登陆界面作为主窗体,把你的主窗体作为子窗体,然后用uses语句调用单元unit。举例:
第一个窗体中的按钮名字为btn1
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,unit2; //引用窗体2的单元文件
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
begin
form1.Hide;
Form2.ShowModal;
end;
end.
第二个窗体中按钮的名字为btn2
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
btn2: TButton;
procedure btn2Click(Sender