1.修改Program.cs文件
默认:
//Form_Order_Content是主窗体 Application.Run(new Form_Order_Content());
改为:
//Form_User_Login是登录窗体 Form_User_Login ful = new Form_User_Login(); ful.ShowDialog(); if (ful.DialogResult == DialogResult.OK) { Application.Run(new Form_Order_Content()); } else { return; }
2.在登录窗体中,当登录成功时调用
this.DialogResult = DialogResult.OK; this.Close();