using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace SetMouse{ public partial class Frm_Main : Form { public Frm_Main() { InitializeComponent(); } [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SwapMouseButton")] public extern static int SwapMouseButton(int bSwap); [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SystemParametersInfo")] public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni); [System.Runtime.InteropServices.DllImport("user32.dll")] public extern static int GetSystemMetrics(int nIndes); [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetDoubleClickTime")] public extern static int SetDoubleClickTime(int wCount); [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetDoubleClickTime")] public extern static int GetDoubleClickTime(); const int SM_SWAPBUTTON = 23;//如左右鼠标键已经交换,则为TRUE const int SPI_SETMOUSE = 4;//设置鼠标的移动速度 const int SPI_GETMOUSESPEED = 112;//检索当前鼠标速度 const uint SPIF_UPDATEINIFILE = 0x0001;//更新win.ini和(或)注册表中的用户配置文件 const uint SPIF_SENDWININICHANGE = 0x0002;//该消息告诉应用程序已经改变了用户配置设置 int aMouseinfo=0; private void Form1_Load(object sender, EventArgs e) { if (GetSystemMetrics(SM_SWAPBUTTON) == 0)//如果鼠标的左右键没有切换 { pictureBox1.Image = null;//清空图片 pictureBox1.Image = Properties.Resources.鼠标左键;//显示图片 checkBox1.Checked = false;//设置复选框为不选中状态 } else//如果鼠标左右切换 { pictureBox1.Image = null;//清空图片 pictureBox1.Image = Properties.Resources.鼠标右键;//显示图片 checkBox1.Checked = true;//设置复选框为选中状态 } int tem_n = 0; switch (Convert.ToInt32(DoubleClickTime_Get()))//获取鼠标的双击速度 { case 900: tem_n = 0; break; case 830: tem_n = 1; break; case 760: tem_n = 2; break; case 690: tem_n = 3; break; case 620: tem_n = 4; break; case 550: tem_n = 5; break; case 480: tem_n = 6; break; case 410: tem_n = 7; break; case 340: tem_n = 8; break; case 270: tem_n = 9; break; case 200: tem_n = 10; break; } trackBar1.Value = tem_n;//显示鼠标的双击速度 SystemParametersInfo(SPI_GETMOUSESPEED, 0, ref aMouseinfo, 0);//获取当前鼠标的移动速度 trackBar2.Value = aMouseinfo;//显示当前鼠标的移动速度 } public string DoubleClickTime_Get() { return GetDoubleClickTime().ToString();//获取鼠标的双击速度 } public void DoubleClickTime_Set(int MouseDoubleClickTime) { SetDoubleClickTime(MouseDoubleClickTime);//设置获取鼠标的双击速度 } private void checkBox1_MouseUp(object sender, MouseEventArgs e) { if (((CheckBox)sender).Checked == true)//如果为选中状态 { pictureBox1.Image = null;//清空图片 pictureBox1.Image = Properties.Resources.鼠标右键;//显示图片 SwapMouseButton(1);//切换鼠标左右键 } else//如果不为选中状态 { if (((CheckBox)sender).Checked == false) { pictureBox1.Image = null;//清空图片 pictureBox1.Image = Properties.Resources.鼠标左键;//显示图片 SwapMouseButton(0);//恢复,设置左键为主键 } } } private void trackBar1_Scroll(object sender, EventArgs e) { int tem_n = 0; switch (((TrackBar)sender).Value)//记录鼠标的双击速度 { case 0: tem_n = 900; break; case 1: tem_n = 830; break; case 2: tem_n = 760; break; case 3: tem_n = 690; break; case 4: tem_n = 620; break; case 5: tem_n = 550; break; case 6: tem_n = 480; break; case 7: tem_n = 410; break; case 8: tem_n = 340; break; case 9: tem_n = 270; break; case 10: tem_n = 200; break; } DoubleClickTime_Set(tem_n);//设置鼠标的双击的速度 } private void trackBar2_Scroll(object sender, EventArgs e) { aMouseinfo = trackBar2.Value;//记录鼠标的移动速度 SystemParametersInfo(SPI_SETMOUSE, 0, ref aMouseinfo, SPIF_UPDATEINIFILE);//设置鼠标的移动速度 } private void checkBox1_CheckedChanged(object sender, EventArgs e) { } }}
下载C# 鼠标设置器 源码下载用户还喜欢
- 18480 文章数
- 500万+ 热度
作者专栏
编辑推荐
- 淡抹u2引擎,修复内容较多,物有所值
- 界域传说·经典巨作=传世单机(一键安装)
- 丸子版本(175个传世版本大集合)
- GS版本:神话公益服务端+客户端
- 图片放大工具(放大图片不模糊)
- 剪映无限制VIP版
- 传奇世界客户端下载器,史上最全传世客户端
- 传世GS20220920商业引擎注册+登录配置器 解压密码是1
- U2官方排行榜游戏网关 支持元神,支持传家宝
- GS开战传世客户端+服务端
- (淡漠夕阳)u2引擎合区工具
- 传世GS引擎消除“你的游戏客户端版本号过旧,请及时更新”提示
- 传世一机多区双线路配置器--免密码版本
- 传世凤凰登陆器劫持修复软件
- SQLite3 for Navicat
- 传奇世界npc对话框编辑工具
- 传世GS落霞铭文服务器端
- gs_20210409引擎包+注册机(无限制)
- 传奇世界NPC对话封包查看器[支持时长版和极速版]
- 彩虹引擎传世脚本编辑工具1.7版来了,支持函数脚本翻译
评论