登录窗体:
type
TfrmLogin = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmLogin: TfrmLogin;
implementation
{$R *.dfm}
procedure TfrmLogin.btn1Click(Sender: TObject);
begin
//登录逻辑
//......
//登录成功后
Self.Hint := 'SUCCESS';
Self.Close;
end;
main窗体:略。。。
项目:
program Project2;
uses
Vcl.Forms,
main in 'main.pas' {frmMain},
login in 'login.pas' {frmLogin};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
ReportMemoryLeaksOnShutdown := True;
frmLogin := TfrmLogin.Create(nil);
frmLogin.ShowModal;
if frmLogin.Hint = 'SUCCESS' then
begin
frmLogin.Free;
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end else begin
frmLogin.Free;
Application.Terminate;
end;
end.
标签:begin,窗口,TfrmLogin,delphi,frmLogin,Application,窗体,end From: https://www.cnblogs.com/del88/p/18231194