| public partial class Form : Form |
| { |
| public Form() |
| { |
| InitializeComponent(); |
| } |
| |
| [System.Runtime.InteropServices.DllImport("user.dll", EntryPoint = "SwapMouseButton")] |
| public extern static int SwapMouseButton(int bSwap); |
| [System.Runtime.InteropServices.DllImport("user.dll", EntryPoint = "SystemParametersInfo")] |
| public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni); |
| [System.Runtime.InteropServices.DllImport("user.dll")] |
| public extern static int GetSystemMetrics(int nIndes); |
| [System.Runtime.InteropServices.DllImport("user.dll", EntryPoint = "SetDoubleClickTime")] |
| public extern static int SetDoubleClickTime(int wCount); |
| [System.Runtime.InteropServices.DllImport("user.dll", EntryPoint = "GetDoubleClickTime")] |
| public extern static int GetDoubleClickTime(); |
| |
| const int SM_SWAPBUTTON =; |
| const int SPI_SETMOUSE =; |
| const int SPI_GETMOUSESPEED =; |
| const uint SPIF_UPDATEINIFILE =x0001; |
| const uint SPIF_SENDWININICHANGE =x0002; |
| int aMouseinfo=; |
| |
| |
| private void Form_Load(object sender, EventArgs e) |
| { |
| if (GetSystemMetrics(SM_SWAPBUTTON) ==) |
| { |
| pictureBox.Image = null; |
| pictureBox.Image = Properties.Resources.鼠标左键; |
| checkBox.Checked = false; |
| } |
| else |
| { |
| pictureBox.Image = null; |
| pictureBox.Image = Properties.Resources.鼠标右键; |
| checkBox.Checked = true; |
| } |
| int tem_n =; |
| switch (Convert.ToInt(DoubleClickTime_Get())) |
| { |
| case: tem_n = 0; break; |
| case: tem_n = 1; break; |
| case: tem_n = 2; break; |
| case: tem_n = 3; break; |
| case: tem_n = 4; break; |
| case: tem_n = 5; break; |
| case: tem_n = 6; break; |
| case: tem_n = 7; break; |
| case: tem_n = 8; break; |
| case: tem_n = 9; break; |
| case: tem_n = 10; break; |
| } |
| trackBar.Value = tem_n; |
| SystemParametersInfo(SPI_GETMOUSESPEED,, ref aMouseinfo, 0); |
| trackBar.Value = aMouseinfo; |
| } |
| |
| public string DoubleClickTime_Get() |
| { |
| return GetDoubleClickTime().ToString(); |
| } |
| |
| public void DoubleClickTime_Set(int MouseDoubleClickTime) |
| { |
| SetDoubleClickTime(MouseDoubleClickTime); |
| } |
| |
| private void checkBox_MouseUp(object sender, MouseEventArgs e) |
| { |
| if (((CheckBox)sender).Checked == true) |
| { |
| pictureBox.Image = null; |
| pictureBox.Image = Properties.Resources.鼠标右键; |
| SwapMouseButton(); |
| } |
| else |
| { |
| if (((CheckBox)sender).Checked == false) |
| { |
| pictureBox.Image = null; |
| pictureBox.Image = Properties.Resources.鼠标左键; |
| SwapMouseButton(); |
| } |
| } |
| } |
| |
| private void trackBar_Scroll(object sender, EventArgs e) |
| { |
| int tem_n =; |
| switch (((TrackBar)sender).Value) |
| { |
| case: tem_n = 900; break; |
| case: tem_n = 830; break; |
| case: tem_n = 760; break; |
| case: tem_n = 690; break; |
| case: tem_n = 620; break; |
| case: tem_n = 550; break; |
| case: tem_n = 480; break; |
| case: tem_n = 410; break; |
| case: tem_n = 340; break; |
| case: tem_n = 270; break; |
| case: tem_n = 200; break; |
| } |
| DoubleClickTime_Set(tem_n); |
| } |
| |
| private void trackBar_Scroll(object sender, EventArgs e) |
| { |
| aMouseinfo = trackBar.Value; |
| SystemParametersInfo(SPI_SETMOUSE,, ref aMouseinfo, SPIF_UPDATEINIFILE); |
| } |
| } |
| partial class Form |
| { |
| |
| |
| |
| private System.ComponentModel.IContainer components = null; |
| |
| |
| |
| |
| |
| protected override void Dispose(bool disposing) |
| { |
| if (disposing && (components != null)) |
| { |
| components.Dispose(); |
| } |
| base.Dispose(disposing); |
| } |
| |
| #region Windows 窗体设计器生成的代码 |
| |
| |
| |
| |
| |
| private void InitializeComponent() |
| { |
| this.groupBox = new System.Windows.Forms.GroupBox(); |
| this.textBox = new System.Windows.Forms.TextBox(); |
| this.checkBox = new System.Windows.Forms.CheckBox(); |
| this.groupBox = new System.Windows.Forms.GroupBox(); |
| this.label = new System.Windows.Forms.Label(); |
| this.label = new System.Windows.Forms.Label(); |
| this.label = new System.Windows.Forms.Label(); |
| this.trackBar = new System.Windows.Forms.TrackBar(); |
| this.textBox = new System.Windows.Forms.TextBox(); |
| this.groupBox = new System.Windows.Forms.GroupBox(); |
| this.trackBar = new System.Windows.Forms.TrackBar(); |
| this.pictureBox = new System.Windows.Forms.PictureBox(); |
| this.pictureBox = new System.Windows.Forms.PictureBox(); |
| this.pictureBox = new System.Windows.Forms.PictureBox(); |
| this.label = new System.Windows.Forms.Label(); |
| this.label = new System.Windows.Forms.Label(); |
| this.label = new System.Windows.Forms.Label(); |
| this.groupBox.SuspendLayout(); |
| this.groupBox.SuspendLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); |
| this.groupBox.SuspendLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.trackBar)).BeginInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); |
| this.SuspendLayout(); |
| |
| |
| |
| this.groupBox.Controls.Add(this.pictureBox1); |
| this.groupBox.Controls.Add(this.textBox1); |
| this.groupBox.Controls.Add(this.checkBox1); |
| this.groupBox.Location = new System.Drawing.Point(12, 12); |
| this.groupBox.Name = "groupBox1"; |
| this.groupBox.Size = new System.Drawing.Size(376, 131); |
| this.groupBox.TabIndex = 0; |
| this.groupBox.TabStop = false; |
| this.groupBox.Text = "鼠标键配置"; |
| |
| |
| |
| this.textBox.BackColor = System.Drawing.Color.WhiteSmoke; |
| this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None; |
| this.textBox.Location = new System.Drawing.Point(15, 51); |
| this.textBox.Multiline = true; |
| this.textBox.Name = "textBox1"; |
| this.textBox.ReadOnly = true; |
| this.textBox.Size = new System.Drawing.Size(230, 28); |
| this.textBox.TabIndex = 3; |
| this.textBox.Text = "选择些复选框来将右按钮设成用于主要功能如选择和拖放之用"; |
| |
| |
| |
| this.checkBox.AutoSize = true; |
| this.checkBox.Location = new System.Drawing.Point(15, 29); |
| this.checkBox.Name = "checkBox1"; |
| this.checkBox.Size = new System.Drawing.Size(144, 16); |
| this.checkBox.TabIndex = 0; |
| this.checkBox.Text = "切换主要和次要的按钮"; |
| this.checkBox.UseVisualStyleBackColor = true; |
| this.checkBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.checkBox1_MouseUp); |
| |
| |
| |
| this.groupBox.Controls.Add(this.pictureBox2); |
| this.groupBox.Controls.Add(this.label3); |
| this.groupBox.Controls.Add(this.label2); |
| this.groupBox.Controls.Add(this.label1); |
| this.groupBox.Controls.Add(this.trackBar1); |
| this.groupBox.Controls.Add(this.textBox2); |
| this.groupBox.Location = new System.Drawing.Point(12, 149); |
| this.groupBox.Name = "groupBox2"; |
| this.groupBox.Size = new System.Drawing.Size(376, 100); |
| this.groupBox.TabIndex = 1; |
| this.groupBox.TabStop = false; |
| this.groupBox.Text = "双击速度"; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(227, 62); |
| this.label.Name = "label3"; |
| this.label.Size = new System.Drawing.Size(17, 12); |
| this.label.TabIndex = 4; |
| this.label.Text = "快"; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(78, 62); |
| this.label.Name = "label2"; |
| this.label.Size = new System.Drawing.Size(17, 12); |
| this.label.TabIndex = 3; |
| this.label.Text = "慢"; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(13, 60); |
| this.label.Name = "label1"; |
| this.label.Size = new System.Drawing.Size(59, 12); |
| this.label.TabIndex = 2; |
| this.label.Text = "速度(D):"; |
| |
| |
| |
| this.trackBar.AutoSize = false; |
| this.trackBar.Location = new System.Drawing.Point(97, 56); |
| this.trackBar.Name = "trackBar1"; |
| this.trackBar.Size = new System.Drawing.Size(126, 30); |
| this.trackBar.TabIndex = 1; |
| this.trackBar.Scroll += new System.EventHandler(this.trackBar1_Scroll); |
| |
| |
| |
| this.textBox.BackColor = System.Drawing.Color.WhiteSmoke; |
| this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None; |
| this.textBox.Location = new System.Drawing.Point(15, 20); |
| this.textBox.Multiline = true; |
| this.textBox.Name = "textBox2"; |
| this.textBox.ReadOnly = true; |
| this.textBox.Size = new System.Drawing.Size(230, 30); |
| this.textBox.TabIndex = 0; |
| this.textBox.Text = "双击文件夹以检测您的设置。如文件夹没打开或关闭,请用慢一点的设置再试一资。"; |
| |
| |
| |
| this.groupBox.Controls.Add(this.label6); |
| this.groupBox.Controls.Add(this.label5); |
| this.groupBox.Controls.Add(this.label4); |
| this.groupBox.Controls.Add(this.pictureBox3); |
| this.groupBox.Controls.Add(this.trackBar2); |
| this.groupBox.Location = new System.Drawing.Point(12, 255); |
| this.groupBox.Name = "groupBox3"; |
| this.groupBox.Size = new System.Drawing.Size(376, 93); |
| this.groupBox.TabIndex = 2; |
| this.groupBox.TabStop = false; |
| this.groupBox.Text = "移动"; |
| |
| |
| |
| this.trackBar.AutoSize = false; |
| this.trackBar.Location = new System.Drawing.Point(108, 49); |
| this.trackBar.Maximum = 20; |
| this.trackBar.Minimum = 1; |
| this.trackBar.Name = "trackBar2"; |
| this.trackBar.Size = new System.Drawing.Size(148, 34); |
| this.trackBar.TabIndex = 0; |
| this.trackBar.Value = 1; |
| this.trackBar.Scroll += new System.EventHandler(this.trackBar2_Scroll); |
| |
| |
| |
| this.pictureBox.Image = global::鼠标设置器.Properties.Resources.移动; |
| this.pictureBox.Location = new System.Drawing.Point(15, 20); |
| this.pictureBox.Name = "pictureBox3"; |
| this.pictureBox.Size = new System.Drawing.Size(43, 37); |
| this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; |
| this.pictureBox.TabIndex = 1; |
| this.pictureBox.TabStop = false; |
| |
| |
| |
| this.pictureBox.Image = global::鼠标设置器.Properties.Resources.文件夹; |
| this.pictureBox.Location = new System.Drawing.Point(301, 23); |
| this.pictureBox.Name = "pictureBox2"; |
| this.pictureBox.Size = new System.Drawing.Size(60, 57); |
| this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; |
| this.pictureBox.TabIndex = 5; |
| this.pictureBox.TabStop = false; |
| |
| |
| |
| this.pictureBox.Image = global::鼠标设置器.Properties.Resources.鼠标左键; |
| this.pictureBox.Location = new System.Drawing.Point(263, 18); |
| this.pictureBox.Name = "pictureBox1"; |
| this.pictureBox.Size = new System.Drawing.Size(98, 101); |
| this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; |
| this.pictureBox.TabIndex = 4; |
| this.pictureBox.TabStop = false; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(64, 20); |
| this.label.Name = "label4"; |
| this.label.Size = new System.Drawing.Size(113, 12); |
| this.label.TabIndex = 2; |
| this.label.Text = "选择指针移动速度:"; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(87, 55); |
| this.label.Name = "label5"; |
| this.label.Size = new System.Drawing.Size(17, 12); |
| this.label.TabIndex = 3; |
| this.label.Text = "慢"; |
| |
| |
| |
| this.label.AutoSize = true; |
| this.label.Location = new System.Drawing.Point(260, 55); |
| this.label.Name = "label6"; |
| this.label.Size = new System.Drawing.Size(17, 12); |
| this.label.TabIndex = 4; |
| this.label.Text = "快"; |
| |
| |
| |
| this.AutoScaleDimensions = new System.Drawing.SizeF(F, 12F); |
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
| this.BackColor = System.Drawing.Color.WhiteSmoke; |
| this.ClientSize = new System.Drawing.Size(, 358); |
| this.Controls.Add(this.groupBox); |
| this.Controls.Add(this.groupBox); |
| this.Controls.Add(this.groupBox); |
| this.Name = "Form"; |
| this.Text = "鼠标设置"; |
| this.Load += new System.EventHandler(this.Form_Load); |
| this.groupBox.ResumeLayout(false); |
| this.groupBox.PerformLayout(); |
| this.groupBox.ResumeLayout(false); |
| this.groupBox.PerformLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit(); |
| this.groupBox.ResumeLayout(false); |
| this.groupBox.PerformLayout(); |
| ((System.ComponentModel.ISupportInitialize)(this.trackBar)).EndInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); |
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); |
| this.ResumeLayout(false); |
| |
| } |
| |
| #endregion |
| |
| private System.Windows.Forms.GroupBox groupBox; |
| private System.Windows.Forms.GroupBox groupBox; |
| private System.Windows.Forms.GroupBox groupBox; |
| private System.Windows.Forms.CheckBox checkBox; |
| private System.Windows.Forms.TextBox textBox; |
| private System.Windows.Forms.PictureBox pictureBox; |
| private System.Windows.Forms.TextBox textBox; |
| private System.Windows.Forms.Label label; |
| private System.Windows.Forms.Label label; |
| private System.Windows.Forms.Label label; |
| private System.Windows.Forms.TrackBar trackBar; |
| private System.Windows.Forms.PictureBox pictureBox; |
| private System.Windows.Forms.TrackBar trackBar; |
| private System.Windows.Forms.PictureBox pictureBox; |
| private System.Windows.Forms.Label label; |
| private System.Windows.Forms.Label label; |
| private System.Windows.Forms.Label label; |
| } |