// created on 20.10.2001 at 18:04
//this example has 2 classes
//1. myfilter, which exposes the imesagefilter interface
//the prefiltermessage method is overriden for our needs
//2. mainform, which is our main form
using system;
using system.windows.forms;
class myfilter:imessagefilter //gets the left mouse button messages
{
public bool prefiltermessage(ref message m)
{
if (m.msg>=513 && m.msg<=515)
{
console.writeline("mouse left button event not accepted!filter working...");
return(true);
}
return(false);
}
}
class mainform : form
{
private button btn=new button();
public mainform() //mainforms constructor
{
//lets put a button on the form
btn.left=30;
btn.top=30;
btn.width=150;
btn.text="try to click me!";
btn.visible=true;
this.controls.add(btn);
}
public static void main()
{
//lets put some filter on our applications message queue
application.addmessagefilter(new myfilter());
//create the mainform object and make it visible
application.run(new mainform());
}
}
文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




