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

📄 otheraction.cs

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


using System.Runtime.InteropServices ;

using Microsoft.Win32 ;
namespace XP界面优化精灵
{
	/// <summary>
	/// OtherAction 的摘要说明。
	/// </summary>
	public class OtherAction : System.Windows.Forms.Form
	{
		public const int GWL_EXSTYLE = (-20);
		public const int WS_EX_TRANSPARENT = 0x20;
		public const int WS_EX_LAYERED = 0x80000;
		private System.Windows.Forms.TabPage tp_1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TrackBar tBar;
		private System.Windows.Forms.Label lb_t;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.Button bn_oa5;
		private System.Windows.Forms.Button bn_oa6;
		private System.Windows.Forms.TextBox toolbartext;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.PictureBox pictureBox3;
		private System.Windows.Forms.TabControl tabControl;
		private System.Windows.Forms.Button bn_oa3;
		private System.Windows.Forms.Button bn_oa4;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.TextBox tb_dialogtext;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox tb_dialogcaption;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.TabPage tp_3;
		private System.Windows.Forms.TabPage tp_2;
		public const int LWA_ALPHA = 0x2;
		[DllImport("user32.dll", EntryPoint="FindWindow")]		public static extern int FindWindow (			string lpClassName,			string lpWindowName			);
		[DllImport("user32.dll", EntryPoint="GetWindowLong")]		public static extern int GetWindowLong (			int hwnd,			int nIndex			);
		[DllImport("user32.dll", EntryPoint="SetWindowLong")]		public static extern int SetWindowLong (			int hwnd,			int nIndex,			int dwNewLong			);
		[DllImport("user32.dll", EntryPoint="SetLayeredWindowAttributes")]		public static extern int SetLayeredWindowAttributes (			int hwnd,			byte crey,			byte bAlpha,			int dwFlags			);
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		public static int tab=0;
		public OtherAction()
		{
			//
			// 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(OtherAction));
			this.tp_1 = new System.Windows.Forms.TabPage();
			this.label2 = new System.Windows.Forms.Label();
			this.tBar = new System.Windows.Forms.TrackBar();
			this.lb_t = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.tp_3 = new System.Windows.Forms.TabPage();
			this.bn_oa5 = new System.Windows.Forms.Button();
			this.bn_oa6 = new System.Windows.Forms.Button();
			this.toolbartext = new System.Windows.Forms.TextBox();
			this.label10 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.pictureBox3 = new System.Windows.Forms.PictureBox();
			this.tabControl = new System.Windows.Forms.TabControl();
			this.tp_2 = new System.Windows.Forms.TabPage();
			this.bn_oa3 = new System.Windows.Forms.Button();
			this.bn_oa4 = new System.Windows.Forms.Button();
			this.label8 = new System.Windows.Forms.Label();
			this.tb_dialogtext = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.tb_dialogcaption = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.tp_1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.tBar)).BeginInit();
			this.tp_3.SuspendLayout();
			this.tabControl.SuspendLayout();
			this.tp_2.SuspendLayout();
			this.SuspendLayout();
			// 
			// tp_1
			// 
			this.tp_1.BackColor = System.Drawing.Color.White;
			this.tp_1.Controls.Add(this.label2);
			this.tp_1.Controls.Add(this.tBar);
			this.tp_1.Controls.Add(this.lb_t);
			this.tp_1.Controls.Add(this.pictureBox1);
			this.tp_1.Location = new System.Drawing.Point(4, 21);
			this.tp_1.Name = "tp_1";
			this.tp_1.Size = new System.Drawing.Size(374, 307);
			this.tp_1.TabIndex = 0;
			this.tp_1.Text = "任务栏透明";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(70, 246);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(246, 28);
			this.label2.TabIndex = 3;
			this.label2.Text = "如将任务栏透明度调为0则将隐藏任务栏。";
			// 
			// tBar
			// 
			this.tBar.Location = new System.Drawing.Point(46, 170);
			this.tBar.Maximum = 255;
			this.tBar.Name = "tBar";
			this.tBar.Size = new System.Drawing.Size(268, 45);
			this.tBar.TabIndex = 2;
			this.tBar.TickFrequency = 10;
			this.tBar.Value = 255;
			this.tBar.Scroll += new System.EventHandler(this.tBar_Scroll);
			// 
			// lb_t
			// 
			this.lb_t.Location = new System.Drawing.Point(178, 110);
			this.lb_t.Name = "lb_t";
			this.lb_t.TabIndex = 1;
			this.lb_t.Text = "透明度100%";
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(86, 90);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(72, 56);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			// 
			// tp_3
			// 
			this.tp_3.BackColor = System.Drawing.Color.White;
			this.tp_3.Controls.Add(this.bn_oa5);
			this.tp_3.Controls.Add(this.bn_oa6);
			this.tp_3.Controls.Add(this.toolbartext);
			this.tp_3.Controls.Add(this.label10);
			this.tp_3.Controls.Add(this.label9);
			this.tp_3.Controls.Add(this.pictureBox3);
			this.tp_3.Location = new System.Drawing.Point(4, 21);
			this.tp_3.Name = "tp_3";
			this.tp_3.Size = new System.Drawing.Size(374, 307);
			this.tp_3.TabIndex = 3;
			this.tp_3.Text = "任务栏文字";
			// 
			// bn_oa5
			// 
			this.bn_oa5.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_oa5.Location = new System.Drawing.Point(92, 224);
			this.bn_oa5.Name = "bn_oa5";
			this.bn_oa5.TabIndex = 13;
			this.bn_oa5.Text = "修改";
			this.bn_oa5.Click += new System.EventHandler(this.bn_oa5_Click);
			// 
			// bn_oa6
			// 
			this.bn_oa6.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_oa6.Location = new System.Drawing.Point(194, 224);
			this.bn_oa6.Name = "bn_oa6";
			this.bn_oa6.TabIndex = 12;
			this.bn_oa6.Text = "还原";
			this.bn_oa6.Click += new System.EventHandler(this.bn_oa6_Click);
			// 
			// toolbartext
			// 
			this.toolbartext.Location = new System.Drawing.Point(92, 166);
			this.toolbartext.Name = "toolbartext";
			this.toolbartext.Size = new System.Drawing.Size(178, 21);
			this.toolbartext.TabIndex = 11;
			this.toolbartext.Text = "";
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(88, 138);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(132, 14);
			this.label10.TabIndex = 10;
			this.label10.Text = "请输入文字:";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(74, 92);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(254, 48);
			this.label9.TabIndex = 1;
			this.label9.Text = "在系统托盘中加入文字,比如加上“我爱你××”。很有个性吧!";
			// 
			// pictureBox3
			// 
			this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
			this.pictureBox3.Location = new System.Drawing.Point(74, 46);
			this.pictureBox3.Name = "pictureBox3";
			this.pictureBox3.Size = new System.Drawing.Size(154, 28);
			this.pictureBox3.TabIndex = 0;
			this.pictureBox3.TabStop = false;
			// 
			// tabControl
			// 
			this.tabControl.Controls.Add(this.tp_1);
			this.tabControl.Controls.Add(this.tp_2);
			this.tabControl.Controls.Add(this.tp_3);
			this.tabControl.ItemSize = new System.Drawing.Size(72, 17);
			this.tabControl.Location = new System.Drawing.Point(8, 8);
			this.tabControl.Name = "tabControl";
			this.tabControl.SelectedIndex = 0;
			this.tabControl.Size = new System.Drawing.Size(382, 332);
			this.tabControl.TabIndex = 0;
			// 
			// tp_2
			// 
			this.tp_2.BackColor = System.Drawing.Color.White;
			this.tp_2.Controls.Add(this.bn_oa3);
			this.tp_2.Controls.Add(this.bn_oa4);
			this.tp_2.Controls.Add(this.label8);
			this.tp_2.Controls.Add(this.tb_dialogtext);
			this.tp_2.Controls.Add(this.label6);
			this.tp_2.Controls.Add(this.tb_dialogcaption);
			this.tp_2.Controls.Add(this.label7);
			this.tp_2.Location = new System.Drawing.Point(4, 21);
			this.tp_2.Name = "tp_2";
			this.tp_2.Size = new System.Drawing.Size(374, 307);
			this.tp_2.TabIndex = 2;
			this.tp_2.Text = "启动对话框";
			// 
			// bn_oa3
			// 
			this.bn_oa3.BackColor = System.Drawing.SystemColors.Control;
			this.bn_oa3.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_oa3.Location = new System.Drawing.Point(96, 226);
			this.bn_oa3.Name = "bn_oa3";
			this.bn_oa3.TabIndex = 12;
			this.bn_oa3.Text = "确定提示";
			this.bn_oa3.Click += new System.EventHandler(this.bn_oa3_Click);
			// 
			// bn_oa4
			// 
			this.bn_oa4.BackColor = System.Drawing.SystemColors.Control;
			this.bn_oa4.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_oa4.Location = new System.Drawing.Point(198, 226);
			this.bn_oa4.Name = "bn_oa4";
			this.bn_oa4.TabIndex = 11;
			this.bn_oa4.Text = "取消提示";
			this.bn_oa4.Click += new System.EventHandler(this.bn_oa4_Click);
			// 
			// label8
			// 
			this.label8.BackColor = System.Drawing.Color.Transparent;
			this.label8.Location = new System.Drawing.Point(82, 136);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(224, 90);
			this.label8.TabIndex = 10;
			this.label8.Text = "此框会在WINDOWS启动到滚动条时显示。你可以充分发挥你的想像力。如在标题栏上写上警告字样。内容写上“你在非法使用此计算机。”";
			// 
			// tb_dialogtext
			// 
			this.tb_dialogtext.Location = new System.Drawing.Point(96, 98);
			this.tb_dialogtext.Name = "tb_dialogtext";
			this.tb_dialogtext.Size = new System.Drawing.Size(178, 21);
			this.tb_dialogtext.TabIndex = 9;
			this.tb_dialogtext.Text = "";
			// 
			// label6
			// 
			this.label6.BackColor = System.Drawing.Color.Transparent;
			this.label6.Location = new System.Drawing.Point(96, 76);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(132, 14);
			this.label6.TabIndex = 8;
			this.label6.Text = "对话框内容:";
			// 
			// tb_dialogcaption
			// 
			this.tb_dialogcaption.Location = new System.Drawing.Point(96, 38);
			this.tb_dialogcaption.Name = "tb_dialogcaption";
			this.tb_dialogcaption.Size = new System.Drawing.Size(178, 21);
			this.tb_dialogcaption.TabIndex = 7;
			this.tb_dialogcaption.Text = "";
			// 
			// label7
			// 
			this.label7.BackColor = System.Drawing.Color.Transparent;
			this.label7.Location = new System.Drawing.Point(96, 16);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(132, 16);
			this.label7.TabIndex = 6;
			this.label7.Text = "对话框标题:";
			// 
			// OtherAction
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(396, 350);
			this.Controls.Add(this.tabControl);
			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 = "OtherAction";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "其它功能";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.OtherAction_Load);
			this.tp_1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.tBar)).EndInit();
			this.tp_3.ResumeLayout(false);
			this.tabControl.ResumeLayout(false);
			this.tp_2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void OtherAction_Load(object sender, System.EventArgs e)
		{
			this.TopMost =action.isTopMost ;
			this.tabControl.SelectedIndex=tab;
			string caption="" ,text="";
			action.getboolDialog (ref caption,ref text);
			this.tb_dialogcaption.Text =caption;
			this.tb_dialogtext.Text  =text;
		}
		private void bn_oa5_Click(object sender, System.EventArgs e)
		{
			if(this.toolbartext .Text.Length >0)
			{
				action.setToolBarText (toolbartext.Text );
				MessageBox.Show ("修改成功,此功能下次登录时就可看见。",action.Caption);
			}
			else
			{
				MessageBox.Show ("请输入文字。",action.Caption);
			}
		}
		private void bn_oa6_Click(object sender, System.EventArgs e)
		{
			action.cancelToolBarText ();
			this.tb_dialogcaption.Text ="";
			this.tb_dialogtext.Text ="";
			MessageBox.Show ("你己经取消该功能。",action.Caption);
		}

		private void bn_oa3_Click(object sender, System.EventArgs e)
		{
			if(this.tb_dialogcaption.Text.Length >0 || this.tb_dialogtext.Text.Length >0)
			{
				action.setboolDialog(this.tb_dialogcaption.Text ,this.tb_dialogtext.Text );
				MessageBox.Show ("修改成功,此功能下次登录时就可看见。",action.Caption);
			}
			else
			{
				MessageBox.Show ("请输入提示文字或标题。",action.Caption);
			}
		}

		private void bn_oa4_Click(object sender, System.EventArgs e)
		{
			action.cancelboolDialog ();
			MessageBox.Show ("你己经取消该功能。",action.Caption);
		}

		private void tBar_Scroll(object sender, System.EventArgs e)
		{
			int LhWnd;
			byte LnLevel=(byte)this.tBar.Value;
			LhWnd = FindWindow("Shell_TrayWnd", null);
			if(LhWnd!=0)
			{
				prvMakeTransparent (LhWnd, LnLevel);
			}
			this.lb_t.Text ="透明度"+this.tBar.Value.ToString ()+"%";
		}
		private void prvMakeTransparent(int LhWnd, byte bLevel)
		{
			int lOldStyle;
			lOldStyle = GetWindowLong(LhWnd, GWL_EXSTYLE);
			SetWindowLong (LhWnd, GWL_EXSTYLE, 0x80000);
			SetLayeredWindowAttributes (LhWnd, 0, bLevel, LWA_ALPHA);
		}
	}
}

⌨️ 快捷键说明

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