通过注册表设置桌面背景
设置 通过 注册表
2023-09-14 09:00:20 时间
实现效果:
知识运用:
RegistryKey类的OpenSubKey方法 //用来检索指定的子项
public RegistryKey OpenSubKey (string name,bool writable) //writable:如果需要项的写访问权限 设为true
实现代码:
private void button2_Click(object sender, EventArgs e) { string path = textBox1.Text; RegistryKey rkey = Registry.CurrentUser; //获取基表 rkey = rkey.OpenSubKey(@"Control Panel\Desktop",true); //检索指定子项 rkey.SetValue("WallPaper",path); rkey.SetValue("TileWallpaper","2"); rkey.Close(); //关闭注册表 MessageBox.Show("设置成功 请重新启动","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); }
相关文章
- 什么是 301 重定向?301 跳转怎么设置?
- 组策略基本安全设置:【交互式登录:试图登录的用户的消息】和【拒绝通过远程桌面服务登录】
- Oracle字段设置不可为空(oracle字段非空)
- button小手设置 css的cursor详解编程语言
- sap-通过定义物料组的评估类-设置无物料号的费用采购详解编程语言
- 利用Oracle设置缓存加快读取速度(oracle设置缓存)
- 网络跨平台:LinuxMac设置网络指南(linuxmac设置)
- MySQL:建立表权限管理体系(mysql对表权限设置)
- 时间解决Java操作Redis 设置Key过期时间(redisjava过期)
- 时间Java连接Redis设置过期时间策略(redisjava过期)
- 怎样在MySQL上设置日志进行更好的管理?(mysql日志设置)