1.创建一个按钮控件
2.在按钮事件复制以下代码
//重启系统
private void Restart(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("确定重启?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
Application.Exit();
}
}