手机
当前位置:查字典教程网 >编程开发 >C#教程 >C# 禁用鼠标中间键的方法
C# 禁用鼠标中间键的方法
摘要:复制代码代码如下:方法如下:声明一个事件:Num_DiscountAmount.MouseWheel+=newMouseEventHandl...

复制代码 代码如下:

方法如下:

声明一个事件:

Num_DiscountAmount.MouseWheel +=new MouseEventHandler(Num_DiscountAmount_MouseWheel);

编写一个事件

private void Num_DiscountAmount_MouseWheel(object sender, MouseEventArgs e)

{

HandledMouseEventArgs h = e as HandledMouseEventArgs;

if (h != null)

{

h.Handled = true;

}

}

还有 第三方控件DevExpress.XtraEditors.SpinEdit ,如何禁用鼠标中间键?

方法如下:

声明事件: (SpinEdit1.Controls[0] as DevExpress.XtraEditors.TextBoxMaskBox).MouseWheel += new MouseEventHandler(Frm_MouseWheel);

编写事件:

void Frm_MouseWheel(object sender, MouseEventArgs e)

{

if (e.Delta != 0)

DevExpress.Utils.DXMouseEventArgs.GetMouseArgs(e).Handled = true;

}

【C# 禁用鼠标中间键的方法】相关文章:

C#获取进程的主窗口句柄的实现方法

C#几种截取字符串的方法小结

解决C#程序只允许运行一个实例的几种方法详解

C# 批处理调用方法

C#图片压缩的实现方法

解析如何正确使用SqlConnection的实现方法

C#短时间内产生大量不重复的随机数

用C#编写获取远程IP,MAC的方法

C# DataGridView添加新行的2个方法

C#中的where泛型约束介绍

精品推荐
分类导航