Exemplo n.º 1
0
 public override void Draw(GeneralGraphics Canvas)
 {
     Canvas.DrawLine(color, x, y, x + width, y);
     Canvas.DrawLine(color, x + width, y, x + width, y + height);
     Canvas.DrawLine(color, x + width, y + height, x, y + height);
     Canvas.DrawLine(color, x, y + height, x, y);
 }
Exemplo n.º 2
0
    public override void Draw(GeneralGraphics Canvas)
    {
        int numPoints = 5;

        Point[] pts = new Point[numPoints];
        double  rx  = width / 2;
        double  ry  = height / 2;
        double  cx  = x + rx;
        double  cy  = y + ry;

        double theta  = -Math.PI / 2;
        double dtheta = 4 * Math.PI / numPoints;
        int    i;

        for (i = 0; i < numPoints; i++)
        {
            pts [i] = new Point(
                Convert.ToInt32(cx + rx * Math.Cos(theta)),
                Convert.ToInt32(cy + ry * Math.Sin(theta)));
            theta += dtheta;
        }

        for (i = 0; i < numPoints; i++)
        {
            Canvas.DrawLine(color, pts[i].X,
                            pts[i].Y,
                            pts[(i + 1) % numPoints].X,
                            pts[(i + 1) % numPoints].Y);
        }
    }