如果鼠标按下,就显示焦点矩形。但是显示了会重叠,一大堆...WM_MOUSEMOVE if(wParam == MK_LBUTTON)
{
hdc= GetDC(hWnd);
SetRect(&rect, (int)LOWORD(lParam), 0,(int)LOWORD(lParam) + 5, rect.bottom);
::DrawFocusRect(hdcSize, &rectCliSize);
}
ReleaseDC(hWnd, hdc);
{
hdc= GetDC(hWnd);
SetRect(&rect, (int)LOWORD(lParam), 0,(int)LOWORD(lParam) + 5, rect.bottom);
::DrawFocusRect(hdcSize, &rectCliSize);
}
ReleaseDC(hWnd, hdc);
不加Invlidate,又重叠...
case WM_MOUSEMOVE:
int nXPos;
int nYPos;
HDC hdcSize;
RECT rectCliSize;
GetClientRect(hWnd, &rectCliSize); nXPos = (int)LOWORD(lParam);
nYPos = (int)HIWORD(lParam); if(wParam == MK_LBUTTON)
{
hdcSize = GetDC(hWnd);
::InvalidateRect(hWnd, &rectCliSize, TRUE);
SetRect(&rectCliSize, (int)LOWORD(lParam), rectCliSize.top, nXPos + 5, rectCliSize.bottom);
::DrawFocusRect(hdcSize, &rectCliSize);
}
ReleaseDC(hWnd, hdcSize);