EDN Admin
Well-known member
首先 在解决方案管理器(Program.cs)里的代码
[csharp] http://blog.csdn.net/qq520360/article/details/7524234#" title="view plain
view plain http://blog.csdn.net/qq520360/article/details/7524234#" title="copy copy http://blog.csdn.net/qq520360/article/details/7524234#" title="print print http://blog.csdn.net/qq520360/article/details/7524234#" title="? ?
<ol>
<span>static <span>void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(<span>false); Form Login = <span>new Login(); Login.ShowDialog();<span>//显示登陆窗体 <span>if (Login.DialogResult == DialogResult.OK) Application.Run(<span>new Main());<span>//判断登陆成功时主进程显示主窗口
<span>else <span>return; } </ol>
<textarea class="csharp" name="code" readonly="readonly" style="display:none; static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form Login = new Login(); Login.ShowDialog();//显示登陆窗体 if (Login.DialogResult
== DialogResult.OK) Application.Run(new Main());//判断登陆成功时主进程显示主窗口 else return; }</textarea>
然后 在登陆窗口(Login.cs)的登陆按钮(BTLogin)Click事件里:
[csharp] http://blog.csdn.net/qq520360/article/details/7524234#" title="view plain
view plain http://blog.csdn.net/qq520360/article/details/7524234#" title="copy copy http://blog.csdn.net/qq520360/article/details/7524234#" title="print print http://blog.csdn.net/qq520360/article/details/7524234#" title="? ?
<ol>
<span>private <span>void BTLogin_Click(<span>object sender, EventArgs e) { <span>if (TBUserName.Text == <span>"www.520360.com" && TBPassWord.Text == <span>"123") { <span>this.DialogResult = DialogResult.OK;<span>//关键:设置登陆成功状态
<span>this.Close(); } <span>else { MessageBox.Show(<span>"账号或密码错误,请重试"); } } </ol>
View the full article
[csharp] http://blog.csdn.net/qq520360/article/details/7524234#" title="view plain
view plain http://blog.csdn.net/qq520360/article/details/7524234#" title="copy copy http://blog.csdn.net/qq520360/article/details/7524234#" title="print print http://blog.csdn.net/qq520360/article/details/7524234#" title="? ?
<ol>
<span>static <span>void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(<span>false); Form Login = <span>new Login(); Login.ShowDialog();<span>//显示登陆窗体 <span>if (Login.DialogResult == DialogResult.OK) Application.Run(<span>new Main());<span>//判断登陆成功时主进程显示主窗口
<span>else <span>return; } </ol>
<textarea class="csharp" name="code" readonly="readonly" style="display:none; static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form Login = new Login(); Login.ShowDialog();//显示登陆窗体 if (Login.DialogResult
== DialogResult.OK) Application.Run(new Main());//判断登陆成功时主进程显示主窗口 else return; }</textarea>
然后 在登陆窗口(Login.cs)的登陆按钮(BTLogin)Click事件里:
[csharp] http://blog.csdn.net/qq520360/article/details/7524234#" title="view plain
view plain http://blog.csdn.net/qq520360/article/details/7524234#" title="copy copy http://blog.csdn.net/qq520360/article/details/7524234#" title="print print http://blog.csdn.net/qq520360/article/details/7524234#" title="? ?
<ol>
<span>private <span>void BTLogin_Click(<span>object sender, EventArgs e) { <span>if (TBUserName.Text == <span>"www.520360.com" && TBPassWord.Text == <span>"123") { <span>this.DialogResult = DialogResult.OK;<span>//关键:设置登陆成功状态
<span>this.Close(); } <span>else { MessageBox.Show(<span>"账号或密码错误,请重试"); } } </ol>
View the full article