新建一个类,继承IMessageFilter public class FormFilter : IMessageFilter { public bool PreFilterMessage(ref Message m) { if (m.Msg == 0x20A) return true; return false; } } 在需要禁用鼠标滚轮的窗体内加入下面的代码 FormFilter ff = new FormFilter(); Application.AddMessageFilter(ff)
基于 Visual Studio 2012 .net framework 4.5 效果截图: 代码: https://download.csdn.net/download/talkwah/10482880 代码预览: using System; using System.Drawing; using System.Windows.Forms; namespace WFA画图 { public partial class Form1 : Form { #region 成员变量 Point m_p1
说明:该篇随笔的代码内容并非出自本人,是在其他网站搜寻的,出处已经不记得了,本次随笔只为记录,目的帮助自己,帮助他人. 实现的原理也不做多的赘述,直接上代码. 第一个类是需要用到的Windows API public class Win32Api { [StructLayout(LayoutKind.Sequential)] public class POINT { public int x; public int y; } [StructLayout(LayoutKind.Sequential
鼠标画矩形: // An example program in which the // user can draw boxes on the screen. // /* License: Oct. 3, 2008 Right to use this code in any way you want without warrenty, support or any guarentee of it working. BOOK: It would be nice if you cited it: L