public bool PreFilterMessage(ref Message m) { if (m_renderPanel != null && m_renderPanel.IsHandleCreated) { if (m.Msg == WM_LBUTTONDOWN || m.Msg == WM_RBUTTONDOWN || m.Msg == WM_MBUTTONDOWN) { CheckFakeFocus(); } if (m.Msg == WM_MOUSEWHEEL && m_fakeFocus) { RenderMethods.WndProc(m_renderPanel.Handle, m.Msg, m.WParam, m.LParam); return(true); } if (m.HWnd == m_renderPanel.Handle || (m_fakeFocus && (m.Msg == WM_KEYDOWN || m.Msg == WM_KEYUP))) { switch (m.Msg) { case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_KEYDOWN: case WM_KEYUP: case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_LBUTTONUP: case WM_LBUTTONDBLCLK: case WM_RBUTTONUP: case WM_RBUTTONDBLCLK: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: case WM_MOUSEMOVE: case WM_MOUSEWHEEL: case WM_CHAR: case WM_CLOSE: { if (m_fakeFocus && m.Msg == WM_LBUTTONDOWN) { System.Drawing.Point position = Cursor.Position; double distance = Math.Round(Math.Sqrt( Math.Pow((position.X - m_mouseDownPosition.X), 2) + Math.Pow((position.Y - m_mouseDownPosition.Y), 2)), 1); if (distance < 3) { System.Drawing.Point relativeToForm = m_renderPanel.PointToClient(position); m_formMain.PickActor(relativeToForm); } } RenderMethods.WndProc(m_renderPanel.Handle, m.Msg, m.WParam, m.LParam); return(true); } } } } return(false); }