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

📄 selectitem.cs

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

namespace XP界面优化精灵
{
	/// <summary>
	/// select 的摘要说明。
	/// </summary>
	public class select : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Button bn_2;
		private System.Windows.Forms.Button bn_1;
		private System.Windows.Forms.CheckBox cb_3;
		private System.Windows.Forms.CheckBox cb_2;
		private System.Windows.Forms.CheckBox cb_1;
		private System.Windows.Forms.Button bn_3;
		private System.Windows.Forms.TextBox tb_chknewpass;
		private System.Windows.Forms.TextBox tb_newpass;
		private System.Windows.Forms.TextBox tb_oldpass;
		private System.Windows.Forms.TrackBar tBar;
		private System.Windows.Forms.Label tb_op;
		private System.Windows.Forms.Label label6;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public select()
		{
			//
			// 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(select));
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.label6 = new System.Windows.Forms.Label();
			this.tBar = new System.Windows.Forms.TrackBar();
			this.tb_op = new System.Windows.Forms.Label();
			this.bn_2 = new System.Windows.Forms.Button();
			this.bn_1 = new System.Windows.Forms.Button();
			this.cb_3 = new System.Windows.Forms.CheckBox();
			this.cb_2 = new System.Windows.Forms.CheckBox();
			this.cb_1 = new System.Windows.Forms.CheckBox();
			this.tabPage2 = new System.Windows.Forms.TabPage();
			this.label5 = new System.Windows.Forms.Label();
			this.bn_3 = new System.Windows.Forms.Button();
			this.tb_chknewpass = new System.Windows.Forms.TextBox();
			this.tb_newpass = new System.Windows.Forms.TextBox();
			this.tb_oldpass = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.label1 = new System.Windows.Forms.Label();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.tBar)).BeginInit();
			this.tabPage2.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Location = new System.Drawing.Point(4, 4);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(350, 320);
			this.tabControl1.TabIndex = 0;
			// 
			// tabPage1
			// 
			this.tabPage1.BackColor = System.Drawing.Color.White;
			this.tabPage1.Controls.Add(this.label6);
			this.tabPage1.Controls.Add(this.tBar);
			this.tabPage1.Controls.Add(this.tb_op);
			this.tabPage1.Controls.Add(this.bn_2);
			this.tabPage1.Controls.Add(this.bn_1);
			this.tabPage1.Controls.Add(this.cb_3);
			this.tabPage1.Controls.Add(this.cb_2);
			this.tabPage1.Controls.Add(this.cb_1);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(342, 295);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "一般设置";
			// 
			// label6
			// 
			this.label6.BackColor = System.Drawing.Color.White;
			this.label6.Location = new System.Drawing.Point(50, 256);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(248, 26);
			this.label6.TabIndex = 13;
			this.label6.Text = "提示:如果同时设了渐隐效果和透明度,下次启动时是先根据渐隐效果的设置。";
			// 
			// tBar
			// 
			this.tBar.Location = new System.Drawing.Point(78, 162);
			this.tBar.Maximum = 100;
			this.tBar.Minimum = 50;
			this.tBar.Name = "tBar";
			this.tBar.Size = new System.Drawing.Size(186, 45);
			this.tBar.TabIndex = 12;
			this.tBar.TickFrequency = 5;
			this.tBar.TickStyle = System.Windows.Forms.TickStyle.Both;
			this.tBar.Value = 100;
			this.tBar.Scroll += new System.EventHandler(this.tBar_Scroll);
			// 
			// tb_op
			// 
			this.tb_op.Location = new System.Drawing.Point(86, 137);
			this.tb_op.Name = "tb_op";
			this.tb_op.Size = new System.Drawing.Size(128, 18);
			this.tb_op.TabIndex = 11;
			this.tb_op.Text = "透明度:100%";
			// 
			// bn_2
			// 
			this.bn_2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_2.Location = new System.Drawing.Point(174, 216);
			this.bn_2.Name = "bn_2";
			this.bn_2.TabIndex = 10;
			this.bn_2.Text = "取消";
			this.bn_2.Click += new System.EventHandler(this.bn_2_Click);
			// 
			// bn_1
			// 
			this.bn_1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_1.Location = new System.Drawing.Point(78, 216);
			this.bn_1.Name = "bn_1";
			this.bn_1.TabIndex = 9;
			this.bn_1.Text = "确认修改";
			this.bn_1.Click += new System.EventHandler(this.bn_1_Click);
			// 
			// cb_3
			// 
			this.cb_3.Location = new System.Drawing.Point(86, 102);
			this.cb_3.Name = "cb_3";
			this.cb_3.Size = new System.Drawing.Size(182, 24);
			this.cb_3.TabIndex = 2;
			this.cb_3.Text = "在WINDOWS启动时运行此程序";
			// 
			// cb_2
			// 
			this.cb_2.Location = new System.Drawing.Point(86, 67);
			this.cb_2.Name = "cb_2";
			this.cb_2.Size = new System.Drawing.Size(160, 24);
			this.cb_2.TabIndex = 1;
			this.cb_2.Text = "主窗口基于所有窗体之前";
			// 
			// cb_1
			// 
			this.cb_1.Location = new System.Drawing.Point(86, 32);
			this.cb_1.Name = "cb_1";
			this.cb_1.Size = new System.Drawing.Size(160, 24);
			this.cb_1.TabIndex = 0;
			this.cb_1.Text = "禁止主窗口的渐隐效果";
			// 
			// tabPage2
			// 
			this.tabPage2.BackColor = System.Drawing.Color.White;
			this.tabPage2.Controls.Add(this.label5);
			this.tabPage2.Controls.Add(this.bn_3);
			this.tabPage2.Controls.Add(this.tb_chknewpass);
			this.tabPage2.Controls.Add(this.tb_newpass);
			this.tabPage2.Controls.Add(this.tb_oldpass);
			this.tabPage2.Controls.Add(this.label4);
			this.tabPage2.Controls.Add(this.label3);
			this.tabPage2.Controls.Add(this.label2);
			this.tabPage2.Controls.Add(this.pictureBox1);
			this.tabPage2.Controls.Add(this.label1);
			this.tabPage2.Location = new System.Drawing.Point(4, 21);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(342, 295);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "安全设置";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(74, 256);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(202, 26);
			this.label5.TabIndex = 9;
			this.label5.Text = "提示:把新密码留空即可取消密码。";
			// 
			// bn_3
			// 
			this.bn_3.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_3.Location = new System.Drawing.Point(130, 216);
			this.bn_3.Name = "bn_3";
			this.bn_3.TabIndex = 8;
			this.bn_3.Text = "确认修改";
			this.bn_3.Click += new System.EventHandler(this.bn_3_Click);
			// 
			// tb_chknewpass
			// 
			this.tb_chknewpass.Location = new System.Drawing.Point(126, 160);
			this.tb_chknewpass.Name = "tb_chknewpass";
			this.tb_chknewpass.PasswordChar = '*';
			this.tb_chknewpass.Size = new System.Drawing.Size(136, 21);
			this.tb_chknewpass.TabIndex = 7;
			this.tb_chknewpass.Text = "";
			// 
			// tb_newpass
			// 
			this.tb_newpass.Location = new System.Drawing.Point(126, 122);
			this.tb_newpass.Name = "tb_newpass";
			this.tb_newpass.PasswordChar = '*';
			this.tb_newpass.Size = new System.Drawing.Size(136, 21);
			this.tb_newpass.TabIndex = 6;
			this.tb_newpass.Text = "";
			// 
			// tb_oldpass
			// 
			this.tb_oldpass.Location = new System.Drawing.Point(126, 84);
			this.tb_oldpass.Name = "tb_oldpass";
			this.tb_oldpass.PasswordChar = '*';
			this.tb_oldpass.Size = new System.Drawing.Size(136, 21);
			this.tb_oldpass.TabIndex = 5;
			this.tb_oldpass.Text = "";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(36, 164);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(66, 17);
			this.label4.TabIndex = 4;
			this.label4.Text = "确认新密码";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(60, 127);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(42, 17);
			this.label3.TabIndex = 3;
			this.label3.Text = "新密码";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(60, 90);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(42, 17);
			this.label2.TabIndex = 2;
			this.label2.Text = "旧密码";
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(66, 18);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(62, 60);
			this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.pictureBox1.TabIndex = 1;
			this.pictureBox1.TabStop = false;
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(126, 46);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(116, 17);
			this.label1.TabIndex = 0;
			this.label1.Text = "启动程序时需要密码";
			// 
			// select
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(358, 334);
			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 = "select";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "软件设置";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.select_Load);
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.tBar)).EndInit();
			this.tabPage2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void bn_1_Click(object sender, System.EventArgs e)
		{
			action.WriteSelectItemSet (this.cb_1.Checked ,this.cb_2.Checked,this.tBar.Value,Application.StartupPath);
			try
			{
				if(this.cb_3.Checked ==true)
				{
					action.SetRunProgram(Application.ExecutablePath);
				}
				else
				{
					action.cancelRunProgram ();
				}
			}
			catch
			{
			}
			Close();
		}
		private void tBar_Scroll(object sender, System.EventArgs e)
		{
			this.tb_op .Text ="透明度:"+this.tBar.Value .ToString ()+"%";
		}

		private void select_Load(object sender, System.EventArgs e)
		{
			this.TopMost =action.isTopMost ;
			try
			{
				bool istrue1=false,istrue2=false;
				int Opacity=0;
				action.ReadSelectItemSet (ref istrue1,ref istrue2,ref Opacity,Application.StartupPath );
				this.cb_1.Checked=istrue1;
				this.cb_2.Checked=istrue2;
				this.tBar.Value =Opacity;
				this.tb_op .Text="透明度:"+Opacity.ToString ()+"%";
				this.cb_3.Checked =action.isSetRunProgram ();
			}
			catch
			{
			}
		}

		private void bn_2_Click(object sender, System.EventArgs e)
		{
			Close();
		}

		private void bn_3_Click(object sender, System.EventArgs e)
		{
			string oepass=action.getPassword ();
			string epass=action.Encryption (this.tb_oldpass.Text );
			if(oepass!=null)
			{
				if(epass==oepass)
				{
					this.passcheck();
				}
				else
				{
					MessageBox.Show ("密码不正确!",action.Caption);
				}
			}
			else
			{
				this.passcheck();
			}
		}
		private void passcheck()
		{
			if(this.tb_newpass .Text==this.tb_chknewpass.Text)
			{
				string epass=action.Encryption (this.tb_newpass.Text );
				action.setPassword (epass);
				MessageBox.Show ("己成功设置密码",action.Caption);
			}
			else
			{
				MessageBox.Show ("确认密码与新密码不同。",action.Caption);
			}
		}
	}
}

⌨️ 快捷键说明

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