将本程序添加到自启动项

try
{
RegistryKey hklm = Registry.LocalMachine;
RegistryKey run = hklm.CreateSubKey(@"SoftwareMicrosoftWindowsCurrentVersionRun");
if (checkBox1.Checked == true)
{
  run.SetValue("thisApplication.exe", System.Windows.Forms.Application.ExecutablePath);
hklm.Close();
}
MessageBox.Show("设置开机成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
}
catch
{ }

以上代码是从别人的项目里面扣出来,不过大家可以自己重载下,写成一个通用的方法。

DevExpress 控件
原文地址:https://www.cnblogs.com/wwwzzg168/p/4111346.html