Is there a way of making the right mouse button act in exactly the same way as the left mouse button when clicking on a grid? Thus the user is able to select a range of cells with the right mouse button etc.
You should process the WM_RBUTTONDOWN and WM_RBUTTONUP message and then call DoLButtonDown. One problem is that DoLButtonDown check checks the flags parameter if MK_RBUTTON is set. Therefore, you have to modify this flag when calling DoLButtonDown.
Example:
void CGXGridWnd::OnRButtonDown(UINT flags, CPoint point)
{
SetAutoScroll(FALSE);
if (!DoLButtonDown(flags & ~MK_RBUTTON | MK_LBUTTON, point))
CWnd::OnRButtonDown(flags, point);
}
void CGXGridWnd::OnRButtonUp(UINT flags, CPoint point)
{
if (!DoLButtonUp(flags & ~MK_RBUTTON | MK_LBUTTON, point))
CWnd::OnRButtonUp(flags, point);
SetAutoScroll(TRUE);
}