title: Rectangle in MFC
body: <p>I try to draw a rectangle on a mfc window using the instructions by: <a href="http://msdn.microsoft.com/en-US/library/8w4fzfxf%28v=VS.80%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-US/library/8w4fzfxf%28v=VS.80%29.aspx</a> . Much though I tried, the Rectangle appears on the border of the window covering the whole of it. What is the problem with the following code int the function OnDraw(CDC* pDC) ? What can be done to draw a Rectangle with particular coordinates in the window?</p>
  
  <pre><code> CPen penBlack;
   penBlack.CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
   CPen* pOldPen = pDC-&gt;SelectObject(&amp;penBlack);
  
   CPoint pt(10, 10);
   CSize sz(100, 50);
   CRect myRect(pt, sz);
   GetClientRect(&amp;myRect);
  
   pDC-&gt;Rectangle(&amp;myRect);  
  </code></pre>