1.重写Main函数
static class Program
{
public static System.Threading.Mutex Run;
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
bool noRun = false;
Run = new System.Threading.Mutex(true, "", out noRun);
if(noRun)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmStart());
}
else
{
}
}
2.在需要重新启动的地方
Program.Run.Close();
Application.Restart();
3627

被折叠的 条评论
为什么被折叠?



