现在的位置: 首页 > 综合 > 正文

生成GraphicsPath

2013年09月17日 ⁄ 综合 ⁄ 共 717字 ⁄ 字号 评论关闭
//gp.PathData
GraphicsPathIterator gpi = new GraphicsPathIterator(gp);
int start, end, count = 0;
count = gpi.NextMarker(out start, out end);
PointF[] points = new PointF[count];
byte[] types = new byte[count];
gpi.CopyData(ref points, ref types, start, end);
sb.Append(string.Format("GraphicsPath path{0} = new GraphicsPath(\r\n", c));
sb.Append("new PointF[] {\r\n");
for (int i = 0; i < points.Length; i++)
{
    sb.Append(String.Format("new PointF({0}F,{1}F)", points[i].X, points[i].Y));
    if (i != points.Length - 1) sb.Append(",");
}
sb.Append(@"},
new System.Byte[] {
");
for (int i = 0; i < types.Length; i++)
{
    sb.Append(types[i].ToString());
    if (i != types.Length - 1) sb.Append(",");
}
sb.Append(" });\r\n");
//resultGP.AddPath(gp, false);
//g.FillPath(Brushes.Red, gp);
//sb.Append(gp.ToString());

抱歉!评论已关闭.