void CArcher2TestView::OnDraw(CDC* pDC) { CRect rect; GetWindowRect(rect); CArcher2TestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // create and select a solid blue brush CBrush brushBlue(RGB(0, 0, 255)); CBrush* pOldBrush = pDC->SelectObject(&brushBlue); int cy_border = GetSystemMetrics(33); // SM_CYFRAME int cy_caption = GetSystemMetrics(SM_CYCAPTION); POINT client_top_left = { 0, 0 }; ClientToScreen(&client_top_left); int menu_height_offset = client_top_left.y - rect.top - cy_caption - cy_border; // create and select a thick, black pen CPen penBlack; penBlack.CreatePen(PS_SOLID, 3, RGB(0, 0, 0)); CPen* pOldPen = pDC->SelectObject(&penBlack); GetClientRect(rect); // shrink our rect 20 pixels in each direction rect.DeflateRect(20, 20); rect.SetRect(rect.left,rect.top,rect.right,rect.bottom + menu_height_offset); // draw a thick black rectangle filled with blue pDC->Rectangle(rect); // put back the old objects pDC->SelectObject(pOldBrush); pDC->SelectObject(pOldPen); }