代码
  private void Restart()
        {
            System.Threading.Thread thtmp 
= new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(run));
            
object appName = Application.ExecutablePath;
            System.Threading.Thread.Sleep(
2000);
            thtmp.Start(appName);
        }
 
        
private void run(Object obj)
        {
            System.Diagnostics.Process ps 
= new System.Diagnostics.Process();
            ps.StartInfo.FileName 
= obj.ToString();
            ps.Start();
        }

 

 

private void btn_restart_Click(object sender, EventArgs e)
        {
            Application.ExitThread();
            Restart();
        }

 

 

调用:

 

Application.ExitThread();
Restart();

相关文章:

  • 2021-08-10
  • 2021-07-05
  • 2021-07-26
  • 2021-08-09
  • 2021-09-16
  • 2021-12-29
  • 2021-07-11
  • 2021-12-12
猜你喜欢
  • 2021-04-28
  • 2021-11-21
  • 2021-06-17
  • 2021-08-30
  • 2021-04-04
  • 2021-10-29
  • 2021-12-04
  • 2021-10-15
相关资源
相似解决方案