我在WM_PAINT中有两个矩形,并且一旦触发WM_MOUSE CLICK EVENT(在每个矩形上切换),我就想在其上绘制Frame Rect。这有可能吗?
答案 0 :(得分:0)
有关鼠标单击,请参见上面的@RemyLebeau评论。然后,在您的WndProc中,类似:
switch (uMsg)
{
// ...
case WM_PAINT:
{
PaintStruct ps;
HDC hDC = BeginPaint (hWnd, &ps);
HBRUSH hBrush = (HBRUSH) GetStockObject (LTGRAY_BRUSH); // say
if (draw_first_rectangle)
FrameRect (hDC, &my_first_rectangle, hBrush);
if (draw_second_rectangle)
FrameRect (hDC, &my_second_rectangle, hBrush);
EndPaint (hWnd, &ps);
return 0;
}
// ...
}
return DefWindowProc (hWnd, uMsg, wParam, lParam);
我确定您可以填写空白。