显示Windows版本号

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

实现效果:

  

知识运用:

  PaintDesktopVersion键

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            RegistryKey rk;
            rk = Registry.CurrentUser;
            rk = rk.CreateSubKey("Control Panel\\Desktop");
            rk.SetValue("PaintDesktopVersion",0);
            MessageBox.Show("设置成功! 请刷新桌面");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            RegistryKey rk;
            rk = Registry.CurrentUser;
            rk = rk.CreateSubKey("Control Panel\\Desktop");
            rk.SetValue("PaintDesktopVersion", 1);
            MessageBox.Show("设置成功!请刷新桌面");
        }