日期:2014-05-18 浏览次数:21048 次
窗体构造函数中加上 TestMessageFilter filter = new TestMessageFilter(); Application.AddMessageFilter(filter); //筛选器类 [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] public class TestMessageFilter : IMessageFilter { public bool PreFilterMessage(ref Message m) { // Blocks all the messages relating to the left mouse button. if (m.Msg >= 513 && m.Msg <= 515) { Console.WriteLine("Processing the messages : " + m.Msg); return true; } return false; } }