有些时候我们想用户在设置完之后使程序重新启动生效,这时候我们只需要简单的应用一下代码即可:

if (MessageBox.Show("设置保存成功,下次启动时生效,是否马上重启软件?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
{
    Application.Exit();
    System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-07-02
  • 2021-12-25
  • 2021-05-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-08-06
相关资源
相似解决方案