zoukankan      html  css  js  c++  java
  • 编程实现改变win7主题

    一  : 解析问题

    1. Windows 7 主题在:%windir%ResourcesThemes  :

     

    2: 我们通过shell 命令  (这个是msdn中提到的)

    rundll32.exe %SystemRoot%system32shell32.dll,Control_RunDLL %SystemRoot%system32desk.cpl desk,@Themes /Action:OpenTheme /file:" %SystemRoot%ResourcesThemesarchitecture.theme"

    3: 写代码  

    [csharp] view plaincopy
    1. using System;  
    2. using System.Collections.Generic;  
    3. using System.ComponentModel;  
    4. using System.Data;  
    5. using System.Drawing;  
    6. using System.Linq;  
    7. using System.Text;  
    8. using System.Windows.Forms;  
    9. using System.IO;  
    10. using System.Threading;  
    11. using System.Diagnostics;  
    12.   
    13. namespace win7改变主题  
    14. {  
    15.     public partial class Form1 : Form  
    16.     {  
    17.         public Form1()  
    18.         {  
    19.             InitializeComponent();  
    20.             string sPath = Environment.GetEnvironmentVariable("windir");//获取系统变量 windir(windows)  
    21.             DirectoryInfo directoryInfo = new DirectoryInfo(sPath + @"ResourcesThemes");  
    22.             foreach (FileInfo i in directoryInfo.GetFiles("*.theme"))  
    23.            {  
    24.                comboBox1.Items.Add(i.FullName);  
    25.            }  
    26.         }  
    27.   
    28.         private void button1_Click(object sender, EventArgs e)  
    29.         {  
    30.             if (comboBox1.SelectedIndex == -1)  
    31.             {  
    32.                 return;  
    33.             }  
    34.             string sFile = comboBox1.SelectedItem.ToString();  
    35.             string sCmd = string.Format(@"  
    36. rundll32.exe %SystemRoot%system32shell32.dll,Control_RunDLL %SystemRoot%system32desk.cpl desk,@Themes /Action:OpenTheme /file:""{0}""", sFile); //cmd命令  
    37.             Process cmd = new Process();  
    38.             cmd.StartInfo.FileName = "cmd";  
    39.             cmd.StartInfo.RedirectStandardInput = true;  
    40.             cmd.StartInfo.RedirectStandardOutput = true;  
    41.             cmd.StartInfo.CreateNoWindow = true;  
    42.             cmd.StartInfo.UseShellExecute = false;  
    43.             cmd.Start();  
    44.             cmd.StandardInput.WriteLine(sCmd);  
    45.             cmd.StandardInput.Flush();  
    46.             cmd.StandardInput.Close();  
    47.             cmd.Close();  
    48.             cmd.Dispose();  
    49.         }  
    50.     }  
    51. }  

    二 执行程序  如图:

     

    三 : 程序源代码 下载:

    http://download.csdn.net/detail/qq283868910/3866000

  • 相关阅读:
    Spring整合JMS-基于activeMQ实现(二)
    iOS 2D绘图详解(Quartz 2D)之概述
    iOS开发UI-利用Quartz2D 实现基本绘图(画三角形、矩形、圆、圆弧)
    Quart 2D 绘制图形简单总结
    IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)
    用 Swift 制作一个漂亮的汉堡按钮过渡动画
    CAShapeLayer和CAGradientLayer
    Swift计算属性
    Swift常用语法示例代码(二)
    Swift 中的指针使用
  • 原文地址:https://www.cnblogs.com/rr163/p/3994091.html
Copyright © 2011-2022 走看看