我现在在设计登陆界面时出现了问题,我是这么做的:
1。新建了mdi application(主界面)和一个form1(作为登陆窗口,用于输入用户名和密码)
2。程序的代码是program Mdiapp;
uses
Forms,
MAIN in 'MAIN.PAS' {MainForm},
login in 'login.pas' {Form1};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
form1:=Tform1.Create(nil);
form1.ShowModal;
end.
3。希望在点击form1的“登陆”按钮后出现mdiappliction界面,然后佛form1界面消失
代码是:
unit login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses MAIN;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.free;
Application.CreateForm(tmainform, mainform);
Application.Run;
end;
编译运行,就有出错信息,我把form1.free语句删除就能正常运行,但是form1登陆没消失,怎么办呀,高手们?