clossing事件中,用Process.Start启动一下自己就可以。
在主窗体的closing事件中,加入如下代码:if ( MessageBox.Show("要重新启动嘛?","提示", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question) == DialogResult.Yes)System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
在主窗体的closing事件中,加入如下代码:if ( MessageBox.Show("要重新启动嘛?","提示", MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question) == DialogResult.Yes)System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
因为我的这个应用程序名为Player.exe 所以就......
private void button1_Click(object sender, System.EventArgs e)
{
Process p=new Process();
p.StartInfo .FileName =@"Player.exe";
p.Start ();
Application.Exit ();
}还请大伙多多指教!
while(true)
{
Process.Start(...)
或在Appdomain里ExecuteAssembly 判断ExitCode
}
(抄袭)