[C#] win7 改变主题
2011-12-01 11:49
134 查看
一 : 解析问题
1. Windows 7 主题在:%windir%\Resources\Themes :
2: 我们通过shell 命令 (这个是msdn中提到的)
rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:" %SystemRoot%\Resources\Themes\architecture.theme"
3: 写代码
二 执行程序 如图:
三 : 程序源代码 下载:
http://download.csdn.net/detail/qq283868910/3866000
1. Windows 7 主题在:%windir%\Resources\Themes :
2: 我们通过shell 命令 (这个是msdn中提到的)
rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:" %SystemRoot%\Resources\Themes\architecture.theme"
3: 写代码
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Threading; using System.Diagnostics; namespace win7改变主题 { public partial class Form1 : Form { public Form1() { InitializeComponent(); string sPath = Environment.GetEnvironmentVariable("windir");//获取系统变量 windir(windows) DirectoryInfo directoryInfo = new DirectoryInfo(sPath + @"\Resources\Themes\"); foreach (FileInfo i in directoryInfo.GetFiles("*.theme")) { comboBox1.Items.Add(i.FullName); } } private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex == -1) { return; } string sFile = comboBox1.SelectedItem.ToString(); string sCmd = string.Format(@" rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:""{0}""", sFile); //cmd命令 Process cmd = new Process(); cmd.StartInfo.FileName = "cmd"; cmd.StartInfo.RedirectStandardInput = true; cmd.StartInfo.RedirectStandardOutput = true; cmd.StartInfo.CreateNoWindow = true; cmd.StartInfo.UseShellExecute = false; cmd.Start(); cmd.StandardInput.WriteLine(sCmd); cmd.StandardInput.Flush(); cmd.StandardInput.Close(); cmd.Close(); cmd.Dispose(); } } }
二 执行程序 如图:
三 : 程序源代码 下载:
http://download.csdn.net/detail/qq283868910/3866000
相关文章推荐
- C#之WinForm基础 通过改变拖拽控件的顺序,将textbox放在panel的下面
- C#里WinForm开发中如何实现控件随窗体大小的改变而自动适应其改变
- C# 无边框窗体随意拖动和改变尺寸【转载】
- android 不同主题下不同状态的button 动态改变文字和图片
- C#实现窗体控件随窗体大小改变(包括字体大小)
- C#改变控件颜色的一些基本方法
- 温故知新ASP.NET 2.0(C#)(2) - Themes(主题)
- 【转】3款Win7仿其他系统主题
- 获得WIN7管理员权限(可通过修改注册表,或者组策略改变)
- 无师自通C#.NET和SQL编程入门免费视频教程大全(由吉日嘎拉精心录制,可以改变一个人职业生涯的入门教程)
- C#调用函数传参数IEnumerable<ClassA> classlist.ToList(),不会改变classlist
- 微信小程序这么火,到底会对C#开发者带来怎样的改变
- C# 解决Datagridview 删除行后index改变的问题
- 【系统之家】win7风景电脑主题下载
- C# 中当前路径的改变
- C# 在运行中改变控件大小的类 并获取最后控件的大小
- XP高仿win7宽栏风格主题
- 若果win7 旗舰版主题突然不能用了,变成 xp经典模式的主题了,这里给出建议办法
- 【C#学习笔记】改变颜色
- C#2005 如何dataGridView的单元格的值发生了改变