Einzelnen Beitrag anzeigen

Assarbad
(Gast)

n/a Beiträge
 
#6

Re: Benutzung von Polygon() (Windows GDI)

  Alt 20. Jan 2005, 03:19
So, hier der Code (funzt jetzt) wie gewünscht:

Code:
void CCreateGroupsView::DrawAromCycle(CDC& DC, unsigned order, unsigned length)
{
   if(!order)
      return;

   int oldidx = DC.SaveDC();
   CPoint org = DC.GetCurrentPosition();
   double angle = (pi * 2) / order, startangle = pi / 2;
   LPPOINT points = new POINT[order], currpoint;

   if(currpoint = points)
   {
      for(unsigned i = 0; i < order; i++)
      {
         currpoint->x = org.x + length * cos(i * angle + startangle);
         currpoint->y = org.y + length * sin(i * angle + startangle);
         currpoint++;
      }
      DC.Polygon(points, order);
      delete points;
   }

   DC.RestoreDC(oldidx);
}
  Mit Zitat antworten Zitat