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

📄 crightkeymenu.cs

📁 XP界面优化精灵, XP界面优化精灵
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// bn_remove2
			// 
			this.bn_remove2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_remove2.Location = new System.Drawing.Point(190, 252);
			this.bn_remove2.Name = "bn_remove2";
			this.bn_remove2.TabIndex = 10;
			this.bn_remove2.Text = "删除";
			this.bn_remove2.Click += new System.EventHandler(this.bn_remove2_Click);
			// 
			// bn_add2
			// 
			this.bn_add2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_add2.Location = new System.Drawing.Point(88, 252);
			this.bn_add2.Name = "bn_add2";
			this.bn_add2.TabIndex = 9;
			this.bn_add2.Text = "添加";
			this.bn_add2.Click += new System.EventHandler(this.bn_add2_Click);
			// 
			// bn_selectpath2
			// 
			this.bn_selectpath2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bn_selectpath2.Location = new System.Drawing.Point(324, 166);
			this.bn_selectpath2.Name = "bn_selectpath2";
			this.bn_selectpath2.Size = new System.Drawing.Size(26, 16);
			this.bn_selectpath2.TabIndex = 8;
			this.bn_selectpath2.Text = "...";
			this.bn_selectpath2.Click += new System.EventHandler(this.bn_selectpath1_Click);
			// 
			// tb_4
			// 
			this.tb_4.Location = new System.Drawing.Point(122, 164);
			this.tb_4.Name = "tb_4";
			this.tb_4.ReadOnly = true;
			this.tb_4.Size = new System.Drawing.Size(230, 21);
			this.tb_4.TabIndex = 7;
			this.tb_4.Text = "";
			// 
			// tb_3
			// 
			this.tb_3.Location = new System.Drawing.Point(122, 140);
			this.tb_3.Name = "tb_3";
			this.tb_3.Size = new System.Drawing.Size(230, 21);
			this.tb_3.TabIndex = 6;
			this.tb_3.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(12, 168);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(122, 23);
			this.label3.TabIndex = 5;
			this.label3.Text = "右键菜单执行命令:";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(12, 144);
			this.label2.Name = "label2";
			this.label2.TabIndex = 4;
			this.label2.Text = "右键菜单名称:";
			// 
			// DDRKMenuList
			// 
			this.DDRKMenuList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						   this.columnHeader1,
																						   this.columnHeader2});
			this.DDRKMenuList.FullRowSelect = true;
			this.DDRKMenuList.GridLines = true;
			this.DDRKMenuList.Location = new System.Drawing.Point(12, 34);
			this.DDRKMenuList.Name = "DDRKMenuList";
			this.DDRKMenuList.Size = new System.Drawing.Size(340, 97);
			this.DDRKMenuList.TabIndex = 3;
			this.DDRKMenuList.View = System.Windows.Forms.View.Details;
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "右键名称";
			this.columnHeader1.Width = 83;
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "执行命令";
			this.columnHeader2.Width = 236;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(152, 18);
			this.label1.TabIndex = 2;
			this.label1.Text = "己经定义的右键菜单命令:";
			// 
			// rb_2
			// 
			this.rb_2.Location = new System.Drawing.Point(122, 190);
			this.rb_2.Name = "rb_2";
			this.rb_2.Size = new System.Drawing.Size(212, 24);
			this.rb_2.TabIndex = 22;
			this.rb_2.Text = "将对象做为执行的程序的参数传递";
			this.rb_2.CheckedChanged += new System.EventHandler(this.rb_2_CheckedChanged);
			// 
			// rb_1
			// 
			this.rb_1.Checked = true;
			this.rb_1.Location = new System.Drawing.Point(16, 190);
			this.rb_1.Name = "rb_1";
			this.rb_1.Size = new System.Drawing.Size(112, 24);
			this.rb_1.TabIndex = 23;
			this.rb_1.TabStop = true;
			this.rb_1.Text = "将直接引用命令";
			this.rb_1.CheckedChanged += new System.EventHandler(this.rb_1_CheckedChanged);
			// 
			// rb_4
			// 
			this.rb_4.Location = new System.Drawing.Point(122, 190);
			this.rb_4.Name = "rb_4";
			this.rb_4.Size = new System.Drawing.Size(212, 24);
			this.rb_4.TabIndex = 24;
			this.rb_4.Text = "将对象做为执行的程序的参数传递";
			// 
			// rb_3
			// 
			this.rb_3.Checked = true;
			this.rb_3.Location = new System.Drawing.Point(16, 190);
			this.rb_3.Name = "rb_3";
			this.rb_3.Size = new System.Drawing.Size(112, 24);
			this.rb_3.TabIndex = 25;
			this.rb_3.TabStop = true;
			this.rb_3.Text = "将直接引用命令";
			// 
			// CRightKeyMenu
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(384, 346);
			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 = "CRightKeyMenu";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "自定义右键菜单";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.CRightKeyMenu_Load);
			this.tabControl.ResumeLayout(false);
			this.tp_1.ResumeLayout(false);
			this.tp_2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		private void CRightKeyMenu_Load(object sender, System.EventArgs e)
		{
			this.TopMost =action.isTopMost ;
			try
			{
				action.ReadFileRKMenuList (ref this.fileRKMenuList ,"c:\\windows");
				action.ReadDDRKMenuList(ref this.DDRKMenuList ,"c:\\windows" );
				this.tabControl .SelectedIndex =tab;
				this.cob_1.Enabled  =isspecific;
				ComboBox cb=new ComboBox ();
				cb =action.getFileTypeList ();
				for(int i=0;i<=cb.Items.Count -1;i++)
				{
					this.cob_1 .Items.Add ((object)cb.Items [i]);
				}
			}
			catch
			{
			}
		}

		private void bn_selectpath1_Click(object sender, System.EventArgs e)
		{
				OpenFileDialog ofd =new OpenFileDialog ();
				ofd.Filter ="*.*|*.*";
				if(ofd.ShowDialog ()==DialogResult.OK )
				{
					Button bn=(Button)sender;
					int n=int.Parse(bn.Name.Substring (bn.Name.Length -1)); 
					if(n==1)
					{
						this.tb_2.Text =ofd.FileName ;
					}
					else
					{
						this.tb_4.Text =ofd.FileName ;
					}
				}
		}

		private void bn_add1_Click(object sender, System.EventArgs e)
		{
			try
			{
				if(this.cob_1 .Enabled)
				{
					action.setRightKeyMenu ("File",this.cob_1.SelectedItem .ToString ().Remove (0,1)+"file" ,this.tb_1.Text ,this.tb_2.Text+param);
					ListViewItem lvi =new ListViewItem (this.cob_1.SelectedItem .ToString ());
					lvi.SubItems.Add (this.tb_1.Text);
					lvi.SubItems .Add (this.tb_2 .Text);
					this.fileRKMenuList.Items.Add (lvi);
				}
				else
				{
					action.setRightKeyMenu ("File","*" ,this.tb_1.Text ,this.tb_2.Text+param);
					ListViewItem lvi =new ListViewItem ("*");
					lvi.SubItems.Add (this.tb_1.Text);
					lvi.SubItems .Add (this.tb_2 .Text);
					this.fileRKMenuList.Items.Add (lvi);
				}
				action.	WriteFileRKMenuList( this.fileRKMenuList ,"c:\\windows");
				MessageBox.Show ("成功添加到文件的右键菜单中。",action.Caption);
			}
			catch
			{
				MessageBox.Show ("	对此文件设右键菜单出错。",action.Caption);
			}
			
		}
		private void bn_remove1_Click(object sender, System.EventArgs e)
		{
			try
			{
				action.removeRightKeyMenu ("File",this.fileRKMenuList.SelectedItems[0].Text.Remove(0,1)+"file",this.fileRKMenuList.SelectedItems[0].SubItems [1].Text);
				this.fileRKMenuList.SelectedItems[0].Remove ();
				action.	WriteFileRKMenuList( this.fileRKMenuList ,"c:\\windows");
				MessageBox.Show ("成功从文件右键菜单删除此项。",action.Caption);
			}
			catch
			{
			}
		}
		private void rb_1_CheckedChanged(object sender, System.EventArgs e)
		{
			param="";
		}
		private void rb_2_CheckedChanged(object sender, System.EventArgs e)
		{
			param=" %1";
		}

		private void tabControl_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if(param=="")
			{
				this.rb_1.Checked =true;
				this.rb_3.Checked =true;
			}
			else
			{
				this.rb_2.Checked =true;
				this.rb_4.Checked =true;
			}
		}

		private void bn_add2_Click(object sender, System.EventArgs e)
		{
			try
			{
				action.setRightKeyMenu ("Folder","*" ,this.tb_3.Text ,this.tb_4.Text+param);
				ListViewItem lvi =new ListViewItem (this.tb_3.Text );
				lvi.SubItems.Add (this.tb_4.Text);
				this.DDRKMenuList.Items.Add (lvi);
				action.WriteDDRKMenuList (this.DDRKMenuList,"c:\\windows");
				MessageBox.Show ("成功添加到驱动器及文件夹的右键菜单中。",action.Caption);
			}
			catch
			{
				MessageBox.Show ("	对此处设右键菜单出错。",action.Caption);
			}
		}
		private void bn_remove2_Click(object sender, System.EventArgs e)
		{
			try
			{
				action.removeRightKeyMenu ("Folder","",this.DDRKMenuList .SelectedItems[0].Text);
				this.DDRKMenuList .SelectedItems[0].Remove ();
				action.WriteDDRKMenuList (this.DDRKMenuList,"c:\\windows");
				MessageBox.Show ("成功从驱动器及文件夹右键菜单删除此项。",action.Caption);
			}
			catch
			{
			}
		}
	}
}

⌨️ 快捷键说明

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