⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xpsuite.cs

📁 XP界面优化精灵, XP界面优化精灵
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;


using System.IO;
using System.Diagnostics;
namespace XP界面优化精灵
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class xpsuite : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.Timer tr_run;
		private System.Windows.Forms.PictureBox pb_1;
		private System.Windows.Forms.Timer tr_2;
		private System.ComponentModel.IContainer components;
		public static string commandLoadpath;

		public xpsuite()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(xpsuite));
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.button1 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.button2 = new System.Windows.Forms.Button();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.button3 = new System.Windows.Forms.Button();
			this.button4 = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.pb_1 = new System.Windows.Forms.PictureBox();
			this.tr_run = new System.Windows.Forms.Timer(this.components);
			this.tr_2 = new System.Windows.Forms.Timer(this.components);
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.BackColor = System.Drawing.Color.Transparent;
			this.groupBox1.Controls.Add(this.button1);
			this.groupBox1.Controls.Add(this.textBox1);
			this.groupBox1.Location = new System.Drawing.Point(8, 10);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.groupBox1.Size = new System.Drawing.Size(352, 48);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "请选择你要转换的程序";
			// 
			// button1
			// 
			this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.button1.Location = new System.Drawing.Point(266, 16);
			this.button1.Name = "button1";
			this.button1.TabIndex = 1;
			this.button1.Text = "浏览...";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(3, 17);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(251, 21);
			this.textBox1.TabIndex = 0;
			this.textBox1.Text = "";
			// 
			// groupBox2
			// 
			this.groupBox2.BackColor = System.Drawing.Color.Transparent;
			this.groupBox2.Controls.Add(this.button2);
			this.groupBox2.Controls.Add(this.textBox2);
			this.groupBox2.Location = new System.Drawing.Point(8, 66);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.groupBox2.Size = new System.Drawing.Size(352, 48);
			this.groupBox2.TabIndex = 1;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "还原(有些程序无法使用XP风格的请用此功能)";
			// 
			// button2
			// 
			this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.button2.Location = new System.Drawing.Point(266, 16);
			this.button2.Name = "button2";
			this.button2.TabIndex = 1;
			this.button2.Text = "浏览...";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// textBox2
			// 
			this.textBox2.Location = new System.Drawing.Point(3, 17);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(251, 21);
			this.textBox2.TabIndex = 0;
			this.textBox2.Text = "";
			// 
			// button3
			// 
			this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.button3.Location = new System.Drawing.Point(88, 158);
			this.button3.Name = "button3";
			this.button3.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.button3.TabIndex = 2;
			this.button3.Text = "转换";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// button4
			// 
			this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.button4.Location = new System.Drawing.Point(190, 158);
			this.button4.Name = "button4";
			this.button4.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.button4.TabIndex = 3;
			this.button4.Text = "还原";
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.Transparent;
			this.label1.Location = new System.Drawing.Point(56, 266);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(258, 30);
			this.label1.TabIndex = 4;
			this.label1.Text = "使用此程序可能有时无法转换,可能原因是该程序的控件非系统默认的控件。";
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Location = new System.Drawing.Point(6, 6);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(374, 362);
			this.tabControl1.TabIndex = 5;
			// 
			// tabPage1
			// 
			this.tabPage1.BackColor = System.Drawing.Color.White;
			this.tabPage1.Controls.Add(this.button3);
			this.tabPage1.Controls.Add(this.button4);
			this.tabPage1.Controls.Add(this.label1);
			this.tabPage1.Controls.Add(this.groupBox1);
			this.tabPage1.Controls.Add(this.groupBox2);
			this.tabPage1.Controls.Add(this.pb_1);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(366, 337);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "XP控件风格";
			// 
			// pb_1
			// 
			this.pb_1.Image = ((System.Drawing.Image)(resources.GetObject("pb_1.Image")));
			this.pb_1.Location = new System.Drawing.Point(112, 238);
			this.pb_1.Name = "pb_1";
			this.pb_1.Size = new System.Drawing.Size(134, 10);
			this.pb_1.TabIndex = 6;
			this.pb_1.TabStop = false;
			// 
			// tr_run
			// 
			this.tr_run.Interval = 1;
			this.tr_run.Tick += new System.EventHandler(this.tr_run_Tick);
			// 
			// tr_2
			// 
			this.tr_2.Enabled = true;
			this.tr_2.Interval = 1;
			this.tr_2.Tick += new System.EventHandler(this.tr_2_Tick);
			// 
			// xpsuite
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(386, 372);
			this.Controls.Add(this.tabControl1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.HelpButton = true;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "xpsuite";
			this.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "XP控件风格";
			this.TopMost = true;
			this.Closing += new System.ComponentModel.CancelEventHandler(this.xpsuite_Closing);
			this.Load += new System.EventHandler(this.Form1_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		private void button1_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog ofd=new OpenFileDialog ();
			ofd.Filter =@"应用程序|*.exe";
			if(ofd.ShowDialog ()==DialogResult.OK )
			{
				this.textBox1.Text =ofd.FileName ;
			}
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog ofd=new OpenFileDialog ();
			ofd.Filter =@"应用程序|*.exe";
			if(ofd.ShowDialog ()==DialogResult.OK )
			{
				this.textBox2.Text =ofd.FileName ;
			}
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			if(File.Exists(textBox1.Text))
			{
				try
				{
					if(!File.Exists(textBox1.Text+".manifest"))
					{
						StreamWriter sw=new StreamWriter (textBox1.Text+".manifest",false);
						sw.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
						sw.WriteLine ("<assembly    xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">");
						sw.WriteLine ("<assemblyIdentity");
						sw.WriteLine ("processorArchitecture=\"x86\"");
						sw.WriteLine ("version=\"5.1.0.0\" ");
						sw.WriteLine ("type=\"win32\"");
						sw.WriteLine ("name=\"MyProgram.exe\"");
						sw.WriteLine ("/>");
						sw.WriteLine ("<dependency>");
						sw.WriteLine ("<dependentAssembly>");
						sw.WriteLine ("<assemblyIdentity");
						sw.WriteLine ("type=\"win32\"");
						sw.WriteLine ("name=\"Microsoft.Windows.Common-Controls\"");
						sw.WriteLine ("version=\"6.0.0.0\" ");
						sw.WriteLine ("publicKeyToken=\"6595b64144ccf1df\"");
						sw.WriteLine ("language=\"*\"");				
						sw.WriteLine ("processorArchitecture=\"x86\"");
						sw.WriteLine ("/>");				
						sw.WriteLine ("</dependentAssembly>");
						sw.WriteLine ("</dependency>");				
						sw.WriteLine ("</assembly>");
						sw.Close ();
						ProcessStartInfo psi=new ProcessStartInfo ("attrib","+h "+textBox1.Text+".manifest");
						psi.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden;
						Process.Start (psi);
						this.tr_run.Start ();
					}
					else
					{
						MessageBox.Show ("文件已被转换。",action.Caption);
					}
				}
				catch
				{
					MessageBox.Show ("文件可能已被转换。",action.Caption);
				}
			}
			else
			{
				MessageBox.Show ("请确认该文件是否存在。",action.Caption);
			}
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			if(File.Exists(textBox2.Text))
			{
				if(File.Exists(textBox2.Text+".manifest"))
				{
					File.Delete (textBox2.Text+".manifest");
					MessageBox.Show ("还原成功。",action.Caption);
				}
			}
			else
			{
				MessageBox.Show ("请确认该文件是否存在。",action.Caption);
			}
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.TopMost =action.isTopMost ;
			this.textBox1.Text =commandLoadpath ;
		}

		private void tr_run_Tick(object sender, System.EventArgs e)
		{
			if(this.pb_1.Height>=130)
			{
				this.tr_run.Stop ();
				MessageBox.Show ("转换完成,如果运行时出错请使用还原功能。",action.Caption);
				this.tr_2.Start ();
			}
			else
			{
				this.pb_1.Top-=5;
				this.pb_1.Height+=5;
			}
		}

		private void tr_2_Tick(object sender, System.EventArgs e)
		{
			if(this.pb_1.Height<=10)
			{
				this.tr_2.Stop ();
			}
			else
			{
				this.pb_1.Top++;
				this.pb_1.Height--;
			}
		}

		private void xpsuite_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			string [] param =System.Environment.GetCommandLineArgs ();
			if(param.Length >1)
			{
				if(param[2]=="XPSuite")
				{
					Application.Exit ();
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -