GraphicsPath* MakeRoundRect(Point topLeft, Point bottomRight, INT percentageRounded)
{
ASSERT (percentageRounded >= 1 && percentageRounded <= 100);
INT left = min(topLeft.X, bottomRight.X);
INT right = max(topLeft.X, bottomRight.X);
INT top = min(topLeft.Y, bottomRight.Y);
INT bottom = max(topLeft.Y, bottomRight.Y);
INT offsetX = (right-left)*percentageRounded/100;
INT offsetY = (bottom-top)*percentageRounded/100;
GraphicsPath pt;
GraphicsPath * path = pt.Clone();
path->AddArc(right-offsetX, top, offsetX, offsetY, 270, 90);
path->AddArc(right-offsetX, bottom-offsetY, offsetX, offsetY, 0, 90);
path->AddArc(left, bottom - offsetY, offsetX, offsetY, 90, 90);
path->AddArc(left, top, offsetX, offsetY, 180, 90);
path->AddLine(left + offsetX, top, right - offsetX/2, top);
return path;
}
原文:
http://www.vckbase.com/document/viewdoc/?id=1428
GDI+画圆角矩形
最新推荐文章于 2019-08-09 16:36:33 发布