I am having some problems with shifting the code from GDI to GDI+.

In the application, the GDI RoundRect function draws the rounded rectangle perfectly but when I use GraphicsPath of GDI+, the corner arcs are not drawn perfectly.

I am using the same coordinates and the same corner ellipse width/height but somehow the corners are not getting overlapped.

Here is my algorithm of RoundRect in GDI+ : -

void DrawRoundedRectangle( IN Rect &rc, IN FLOAT radius, IN COLORREF clr, IN FLOAT lineWidth )
float diameter;

diameter = ceil(radius) * 2.0F;
SizeF sizeF(diameter, diameter);
RectF arc((REAL)rc.X, (REAL)rc.Y, sizeF.Width, sizeF.Height);

GraphicsPath path;

path.AddArc(arc, 180, 90);

arc.X = rc.GetRight() - diameter;
path.AddArc(arc, 270, 90);

arc.Y = rc.GetBottom() - diameter;
path.AddArc(arc, 0, 90);

arc.X = (REAL)rc.GetLeft();
path.AddArc(arc, 90, 90);


Pen p( Color( GetRValue(clr), GetGValue(clr), GetBValue(clr) ), lineWidth );

Graphics *g = Graphics::FromHDC( m_hDC );
g->DrawPath( &p, &path );
delete g;

Any help will be highly appreciated.

Thanks & Regards.