
HDC hdc = ::GetDC(m_hWnd);
RECT rect = { 10,10,100,100 };
RECT rect1 = {50,50,150,150};
RECT rect2;
HBRUSH hbr;
hbr = CreateSolidBrush(RGB(0, 0, 255));
SelectObject(hdc, hbr);
int f = FrameRect(hdc, &rect, hbr);
f = FrameRect(hdc, &rect1, hbr);
BOOL b= IntersectRect(&rect2,&rect1,&rect); //指向两个源矩形相交的矩形
/*
参数1:LPCRECT lprcDst 指向两个源矩形相交的矩形
参数2:LPCRECT lpRect1 源矩形
参数3:LPCRECT lpRect2 源矩形
返回值:如果交不为空,则返回非零值;否则,如果交为空则返回0
*/
Sleep(2000);
hbr = CreateSolidBrush(RGB(255, 0, 0));
SelectObject(hdc, hbr);
f = FrameRect(hdc, &rect2, hbr);
DeleteObject(hbr);
::ReleaseDC(m_hWnd, hdc);
