系统重新登陆要如何实现 我想给WINFORM的程序加个这样的功能,点一个button则注销(或者说退出)当前系统,然后启动登陆界面。我想应该不是hide()当前,再show()主窗口吧?请高手指教。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 很久没做winform的了 ,应该可以close了 在show主窗体 我理解楼主的意思是在Form1中点击按钮关闭Form1,然后自动启动Form2。这样的话可以在Form1中设置一个public bool bBtnQuitPressed; 点击按钮后处理该变量,然后在获取Form1的DialogResult的代码地方判断此变量,根据变量情况,调用Form2。 Application.Restart();用这句就可以实现了。 谢谢LS的各位,但是如果这样写要怎么写?Application.Current.Shutdown(); System.Diagnostics.Process PP = new System.Diagnostics.Process(); PP.Start(); System.Reflection.Assembly.GetEntryAssembly(); Login MyLogin = new Login(); MyLogin.Show(); this.Dispose();这样就行了啊 说实话 就可以用你自己说的方法先hide 再show为什么不行呢?只要能实现需求就可以了 已经解决了,谢谢各位。WPF的,以下代码供参考。 private void MenuISystem_Click(object sender, RoutedEventArgs e) {//退出系统代码 if ((e.Source as MenuItem).Header.ToString().Trim() == "退出系统") { if (MessageBox.Show("是否退出系统?", "确认退出", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.DefaultDesktopOnly) == MessageBoxResult.Yes) { isResert = true; Application.Current.Shutdown(); } } else {//注销系统代码 // Application.Current.Shutdown(); isResert = true; Application.Current.Shutdown(); ResertSystem(); } } private void ResertSystem() { System.Reflection.Assembly.GetEntryAssembly(); string startpath = System.IO.Directory.GetCurrentDirectory(); System.Diagnostics.Process.Start(startpath + "/WpfApplication1.exe"); } 求教!有关C#播放器发送通知的问题 C#按钮快捷键问题 c#高级编程第11章反射例程的疑问? 简单!新手请教 :连动的日期下拉菜单 怎样在代码里获得所选的值? 如何用c#的语句来建立数据库? 文件上传的问题 为什么我重定向后不能正确执行bat文件 ie中自动完成功能 Wpf应用程序关闭时弹出Appcrash 请各位介绍一些有用的关于.NET的好网站 泛型 List 的BinarySearch用法 求sql server 2005 查询慢的原因
Application.Current.Shutdown();
System.Diagnostics.Process PP = new System.Diagnostics.Process();
PP.Start();
System.Reflection.Assembly.GetEntryAssembly();
MyLogin.Show();
this.Dispose();
这样就行了啊
先hide 再show
为什么不行呢?
只要能实现需求就可以了
{//退出系统代码
if ((e.Source as MenuItem).Header.ToString().Trim() == "退出系统")
{
if (MessageBox.Show("是否退出系统?", "确认退出", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.DefaultDesktopOnly) == MessageBoxResult.Yes)
{
isResert = true;
Application.Current.Shutdown();
}
}
else
{//注销系统代码
// Application.Current.Shutdown();
isResert = true;
Application.Current.Shutdown();
ResertSystem();
}
} private void ResertSystem()
{
System.Reflection.Assembly.GetEntryAssembly();
string startpath = System.IO.Directory.GetCurrentDirectory();
System.Diagnostics.Process.Start(startpath + "/WpfApplication1.exe");
}