I am not sure if i understood the question correctly, but to calculate the vertices of octagon given the center(x,y) and radius R you can use this:
void Octagon(HDC hDC, int x, int y, int R)
{
int R2 = int(R/sqrt(2));
POINT pt[8];
pt[0].x = x; pt[0].y = y - R;
pt[1].x = x + R2 pt[1].y = y - R2;
pt[2].x = x + R; pt[2].y = y;
pt[3].x = x + R2; pt[3].y = y + R2;
pt[4].x = x; pt[4].y = y + R;
pt[5].x = x - R2; pt[5].y = y + R2;
pt[6].x = x - R; pt[6].y = y;
pt[7].x = x - R2; pt[7].y = y - R2;
Polygon(hDC, pt, 8);
}
(from
codeguru.com/forum)
Now, you can draw any polygon (including octagon) on GDI+ with:
PointF myPointFArray[] = {PointF(1, 1),
PointF(20, 10), PointF(5, 4), PointF(100, 2),
PointF(200, 50), PointF(39, 45)};
g->DrawPolygon(myPen, myPointFArray);
(
Drawing Lines and Shapes with GDI+)
using sample
Drawing a Line as a template.