public LoginForm() { InitializeComponent(); //判断是否调试状态 Process currentProcess = Process.GetCurrentProcess();//获取当前进程 //获取当前运行程序完全限定名 string currentFileName = currentProcess.MainModule.FileName; if (currentFileName.EndsWith("vshost.exe")) { GlobalVar.IsDebug = true; } else { GlobalVar.IsDebug = false; } }