Programming changes the win7 theme, programming implements the win7 theme
I. Resolution
1. Windows 7 theme: % windir % \ Resources \ Themes:
2: We use the shell command (this is mentioned in msdn)
Rundll32.exe % SystemRoot % \ system32 \ shell32.dll, Control_RunDLL % SystemRoot % \ system32 \ desk. cpl desk, @ Themes/Action: OpenTheme/file: "% SystemRoot % \ Resources \ Themes \ architecture. theme"
3: write code
[Csharp]View plaincopy
- 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 changed theme
- {
- Public partial class Form1: Form
- {
- Public Form1 ()
- {
- InitializeComponent ();
- String sPath = Environment. GetEnvironmentVariable ("windir"); // obtain the system variable windir (windows)
- DirectoryInfo directoryInfo = new DirectoryInfo (sPath + @ "\ Resources \ Themes \");
- Foreach (FileInfo I in directoryInfo. GetFiles ("*. theme "))
- {
- ComboBox1.Items. Add (I. FullName );
- }
- }
- Private void button#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 command
- 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 ();
- }
- }
- }
2. Execution program:
3. Download the program source code:
Http://download.csdn.net/detail/qq283868910/3866000
How does win7 change themes?
Hello, you can right-click and select the pop-up dialog box in the personalized bar. You can set the theme based on your preferences. However, the theme that comes with the system is generally not recommended. download from the zone. If you need to send me your email address, you can send me a few for you. If you agree, please accept the answer. Thank you.
How can I change the background of my computer in WIN7?
Are you talking about the background of folders?