title: Rotate a line segment in Visual C++
body: <p>Well I am trying to build a few small windows applications using MFC and trying to learn how things work, and while drawing a country's flag I got stuck. Following lines of code draw three rectangles and a circle right at the center of middle rectangle, what need to do next is draw spokes in to circle, i.e 8 diameters separated by an angle of 45 degrees.</p>
  
  <pre><code>void CMainWindow::OnPaint (){
  CPaintDC dc(this);
  for (int i=0;i &lt;=100;i+=50) {
      dc.SetBkMode(TRANSPARENT);
      CRect rect;
      CPen pen(PS_SOLID, 1, RGB(0,0,0));
      CPen *oldPen = dc.SelectObject(&amp;pen);
      if (i == 0){
           CBrush brush(RGB(255,130,0));
           CBrush *oldBrush = dc.SelectObject(&amp;brush);
           dc.Rectangle(75,(i+50),275,(i+100));
      }
      else if(i == 50) {
           CBrush brush(RGB(255,255,255));
           CBrush *oldBrush = dc.SelectObject(&amp;brush);
           dc.Rectangle(75,(i+50),275,(i+100));
           CPen pen2(PS_SOLID, 1,RGB(0,0,255));
           CPen *oldPen = dc.SelectObject(&amp;pen2);
           dc.Ellipse(150,100,200,150);
      }
      else {
           CBrush brush(RGB(34,139,34));
           CBrush *oldBrush = dc.SelectObject(&amp;brush);
           dc.Rectangle(75,(i+50),275,(i+100));
      }
  }
  </code></pre>
  
  <p>I have no clue how to do that, I tried to find it in the MFC library but no luck!</p>