Hi,

I'm trying to add the ability for a user to select multiple objects within my window via dragging the mouse to create a focus rectangle (or bounding box) around the objects they wish to select. The thing is, I would like to know the best painting practices for this process. I've currently written (in the WindowProc):-
Code:
(iButton and ptPos are global variables... I'll fix that when this works!)
case WM_LBUTTONDOWN:
{
	ptPos.x = MAKEPOINTS(lParam).x;
	ptPos.y = MAKEPOINTS(lParam).y;
	iButton = TRUE;
	break;
}
case WM_LBUTTONUP:
{
	iButton = FALSE;
	break;
}
case WM_MOUSEMOVE:
{
	if (iButton == TRUE)
	{
		HDC dc;
		RECT rc;
		
		dc = GetDC(hwnd);
		rc.left = ptPos.x;
		rc.top = ptPos.y;
		rc.right = MAKEPOINTS(lParam).x;
		rc.bottom = MAKEPOINTS(lParam).x;
		DrawFocusRect(dc, &rc);
		ReleaseDC(hwnd, dc);
	}
	break;
}
This generates a focus rectangle when the user holds the left mouse button down and drags it across the window. My point is, what's the best way to repaint the sections of the window formerly covered by the focus rectangle? It doesn't seem to deal properly with negative coordinates, either...