Hi Adam,
The only way I can think of is to create message filter and screen off the
mouse messages.
1. Add IMessageFilter interface to the list of interfaces implemented by the
form
public class MyForm: Form, IMessageFilter
{
.....
}
2. In form constructor add the following line
Application.Add MessageFilter(t his);
3. Implement the IMessageFilter' s only member in the form's class
Something like
public bool PreFilterMessag e(ref Message m)
{
Control ctrl = Control.FromHan dle(m.HWnd);
if(ctrl != null && (ctrl == this || this.Contains(c trl))))
{
switch(m.Msg)
{
case 0x0201: //0x0201 is the constant value for
WM_LBUTTONDOWN. For more constants see winuser.h
///Do something when the left-mouse button is down
break
case .....
break
}
}
return false;
}
HTH
B\rgds
100
"Kubik" <ku***@Iname.co m> wrote in message
news:eu******** *****@TK2MSFTNG P11.phx.gbl...
Hello!
How to detect mouseclick anywhere on the form? There is a lot of
controls on the form, so I don't want to add eventhandler for each of
them. How can I do it in another way?
Adam
--
**remove REM from the mail address**