首页 > 学院 > 开发设计 > 正文

大家帮帮忙哈,C#图形设计的

2019-11-17 04:05:37
字体:
来源:转载
供稿:网友
public override void Draw(System.Drawing.Graphics g)
        {
            float delta = (float)Math.PI / 12;
            PointF[] inPoints = new PointF[24];
            PointF[] outPoints = new PointF[24];
            float outA = Rectangle.Width / 2;
            float outB = Rectangle.Height / 2;
            float inA = Rectangle.Width * 3 / 8;
            float inB = Rectangle.Height * 3 / 8;

            float centerX = Rectangle.X + Rectangle.Width / 2;
            float centerY = Rectangle.Y + Rectangle.Height / 2;

            float inAngle = delta / 2;
            float outAngle = delta;
            for (int i = 0; i < 24; i++)
            {
                inPoints[i].X = centerX + inA * (float)Math.Cos(inAngle);
                inPoints[i].Y = centerY + inB * (float)Math.Sin(inAngle);

                outPoints[i].X = centerX + outA * (float)Math.Cos(outAngle);
                outPoints[i].Y = centerY + outB * (float)Math.Sin(outAngle);
                inAngle += delta;
                outAngle += delta;
            }
            for (int i = 0; i < 23; i++)
            {
                g.DrawLine(Pens.Black, inPoints[i], outPoints[i]);
                g.DrawLine(Pens.Black, outPoints[i], inPoints[i + 1]);
            }
            g.DrawLine(Pens.Black, inPoints[23], outPoints[23]);
            g.DrawLine(Pens.Black, outPoints[23], inPoints[0]);
        }

效果是画出24角型
请问,这些语句是什么意思啊?看不懂啊
            float delta = (float)Math.PI / 12;


要产生的图形就是Word文档中自定义图形中的24角星,然后这边用PI除以12有什么用意,超级不明白啊;而且如果把12变成8,然后改相应的数组个数,就可以产生16角星,所以不明白变量delta在这里的作用?????? 
上一篇:CTHREAD C#

下一篇:C#取存储过程的数据

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表