首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > C# > C# 禁止鼠标左键单击的实现源码

C# 禁止鼠标左键单击的实现源码

  • 资源大小:27.88 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: C#源码

资 源 简 介

C# 禁止鼠标左键单击,附上例子源码,禁止后将不响应鼠标左键消息,当然也可恢复鼠标左键,直接关闭本程序即可恢复,实现方法也很简单,看如下代码:   private void button1_Click(object sender, EventArgs e)   {//禁止鼠标左键单击    Application.AddMessageFilter(this);    MessageBox.Show("鼠标左键已经被禁止,请用Tab键执行操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);   }   private void button2_Click(object sender, EventArgs e)   {//允许鼠标左键单击    Application.RemoveMessageFilter(this);    MessageBox.Show("鼠标左键已经被解禁,可以执行操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);   }   public bool PreFilterMessage(ref System.Windows.Forms.Message MySystemMessage)   {//不响应鼠标左键消息    if (MySystemMessage.Msg >= 513 && MySystemMessage.Msg <= 515)    return true;    return false;   }

文 件 列 表

srcfans.com
noleftkey
MyForm
Form1.Designer.cs
noleftkey
noleftkey
MyForm
Form1.cs
srcfans.com
VIP VIP
0.182066s