using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Windows.Forms; namespace M423project { static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { bool createNew; using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew)) { if (createNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new MainForm()); FormStartup.LoadAndRun(new MainForm()); } else { // 程序已经运行,显示提示后退出 MessageBox.Show("应用程序已经运行!"); System.Environment.Exit(0); } } } } }