I have found the solution for this event.... but it carries some error..
protected override void WndProc(ref Message m)
{
Screen Src = Screen.PrimaryScreen;
if ( m.Msg == (int)WM_LBUTTONDOWN)
{
int x = m.LParam.ToInt32() & Src.Bounds.Width;
int y = m.LParam.ToInt32() & Src.Bounds.Height;
OnMDIMouseLBtnDown(new MouseEventArgs(MouseButtons.Left, 1, x, y, 0));
OnMDIMouseLBtnDown(new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, x, y, 0));
}
else if (m.Msg == (int)WM_NCMOUSEMOVE || m.Msg == WM_MOUSEMOVE)
{
int x = m.LParam.ToInt32() & Src.WorkingArea.X;
int y = m.LParam.ToInt32() & Src.WorkingArea.Y;
OnMDIMouseMove(new MouseEventArgs(MouseButtons.None, 0, m.LParam.ToInt32(), m.LParam.ToInt32(), 0));
}
base.WndProc(ref m);
}
protected virtual void OnMDIMouseLBtnDown(MouseEventArgs e)
{
if (e.X <=250 && e.Y >=200)
{
MessageBox.Show("X: " + (e.X).ToString() + Environment.NewLine +
"Y: " + (e.Y).ToString() + Environment.NewLine);
}
}
protected virtual void OnMDIMouseMove(MouseEventArgs e)
{
MessageBox.Show("X: " + (e.X).ToString() + Environment.NewLine +
"Y: " + (e.Y).ToString());
}
but mdi form does not notice wm_mousemove...
it only detects the wm_mouseactivate,
what can be the solution..
moreover i am unable to find the accurate mouse location...