My program does not want the mouse to touch the listbox on the form, what should I do? or let the mouse not touch the entire form, you can only click the Close button to close the form can also be. In there is simply let the mouse malfunction, set a keyboard shutdown program
You can add the message to the application and processing, so that you can control the mouse message function, such as the following code:
Class Msgfilter:imessagefilter
{
public bool Prefiltermessage (ref message M)
{
if (m.msg = = 0x100 && M.wparam = = (INTPTR) 0x11)//(Wm_rbuttondown)
{
This returns true to indicate that the application is not processing this message and
Make this message invalid and you can find additional mouse messages to add here.
return true;
}
}
}
<summary>
The main entry point for the application.
</summary>
[STAThread]
static void Main ()
{
Application.enablevisualstyles ();
Msgfilter ms=new Msgfilter ()//Add Message Filter
Application.addmessagefilter (MS);
Application.setcompatibletextrenderingdefault (FALSE);
Application.Run (New Form1 ());
Application.removemessagefilter (MS);//Remove Message Filter
}