管理屏幕保护设置

Posted on 2019-01-29 05:27  努力成长静待花开  阅读(221)  评论(0编辑  收藏  举报

实现效果:
  

知识运用:

  NoDispScrSavPage键值

实现代码:

        private void radioButton2_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
            if (radioButton1.Checked == true)
                rk.SetValue("NoDispScrSavPage", 1, RegistryValueKind.DWord);
            else if (radioButton2.Checked == true)
                rk.SetValue("NoDispScrSavPage", 0, RegistryValueKind.DWord);}
        }