删除我的电脑上下菜单中的属性

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

实现效果:

  

知识运用:

  NoPropertiesMyComputer键

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
            rk.SetValue("NoPropertiesMyComputer",1,RegistryValueKind.DWord);
            MessageBox.Show("删除\"属性\"功能成功");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
            rk.SetValue("NoPropertiesMyComputer", 0, RegistryValueKind.DWord);
            MessageBox.Show("恢复\"属性\"功能成功");
        }