打开MDI子窗体时如何停用Mdi父窗体
你好,
在我的应用程序中,我有一个登录屏幕和一个透明的主菜单屏幕.现在,当我运行应用程序时,将加载mainmenu屏幕,同时还将显示登录屏幕,并在登录屏幕上设置焦点.现在,当激活登录屏幕后,我将尝试停用主菜单,并在有效登录后激活主菜单并关闭登录屏幕.
在有效登录之前,不应激活mainmenu表单.
Hello,
In my application I have a login screen and a main menu screen which is mdiparent. Now when I run application, mainmenu screen get loaded, also at the same time login screen is also displayed and focus is set on login screen. Now when login screen is activated then I am trying to deactivate the main menu and after valid login activate main menu and close the login screen.
The mainmenu form should not be activated till valid login.
How to do this please help??
使用myLoginForm.ShowDialog方法从MainMenu内显示登录屏幕.
Display your login screen from within the MainMenu using the myLoginForm.ShowDialog method.
在显示MainMenu表单之前,先从Main方法显示登录表单
Show your Login Form from the Main method before showing the MainMenu Form
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MyLoginForm login = new MyLoginForm();
if (login.ShowDialog() == DialogResult.Ok)
{
Application.Run(new MainmenuForm());
}
}
检查有效登录名应该在MyLoginForm
中完成,该操作仅应返回OK
进行有效登录.
Checking for a valid login should be done in MyLoginForm
, which should only return OK
for a valid login.
OriginalGriff提到了它-不要将登录屏幕设置为MdiChild -只需使用"ShowDialog"将其显示为模式窗口
OriginalGriff mentioned it - don''t make your login screen a MdiChild - just show it as modal window with "ShowDialog"