title: Can someone explain me the CDC::SelectObject to me?
body: <p><a href="http://msdn.microsoft.com/en-us/library/sa8ahz7h(v=vs.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/sa8ahz7h(v=vs.80).aspx</a></p>
  
  <pre><code>//Border
          CPen pen;
          pen.CreatePen(PS_DASH, 20, RGB(0, 0, 0));
          CPen* penOld = dc.SelectObject(&amp;pen);
  
          dc.Rectangle(rect);
          dc.FillRect(rect, &amp;brush);
  </code></pre>
  
  <p>How does this code work? It draws a rectangle and then a border around it. I just can't get my head around it.</p>