C# winform 运行时只显示登录窗体

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();

 

posted @ 2018-04-13 10:46  履霜.1989  阅读(422)  评论(0编辑  收藏  举报