主窗口启动:
void Main()
{
frmLogon log=new frmLogon(); 实例一个登录窗体
if (LogonSuccess)
{
Application.Run(new frmMain);
}
else
{
Application.Exit();
}
登录窗体:
private static bool LogonSuccess=false;
登录成功时:
LogonSuccess=true;
this.Hide();
void Main()
{
frmLogon log=new frmLogon(); 实例一个登录窗体
if (LogonSuccess)
{
Application.Run(new frmMain);
}
else
{
Application.Exit();
}
登录窗体:
private static bool LogonSuccess=false;
登录成功时:
LogonSuccess=true;
this.Hide();
frmLogin frmLogin1 = frmLogin();
frmLogin.ShowDialog();
在frmLogin中加入如下的代码:
this.hide();
在注销按扭事件中加如下代码:
this.hide();
frmLogin.show();
你用的方法,frmLogon log=new frmLogon(); 实例一个登录窗体
什么时候显示登陆窗口呢????
在注销按扭事件中加如下代码:
this.hide();
frmLogin.show();这最后一句中,frmLogin找不到了````````
private LogForm formLogon;
private void MainForm_Load(object sender, System.EventArgs e)
{
formLogon= new LogForm(this);
formLogon.ShowDialog();}
this.Hide();
Form1 form = new Form1();
form.Show();
登陆窗口的登陆按钮的代码:
this.Hide();
Form2 form2= new Form2();
form2.Show(); 这样可以实现窗口的切换。
你这样写,不是每次都生成了一个新的对象吗????还隐藏已经没必要了,我并不希望新创建窗口``````只是想吉活隐藏的窗口