Exemplo n.º 1
0
    public override void Draw(IDrawing d)
    {
        points    = new Point[5];
        points[0] = new Point(x, y);
        points[1] = new Point(x + width, y);
        points[2] = new Point(x + width, y + height);
        points[3] = new Point(x, y + height);
        points[4] = new Point(x, y);

        d.DrawPolyLine(points, c);
    }
Exemplo n.º 2
0
    public override void Draw(IDrawing d)
    {
        int numPoints = 5;

        Point[] pts = new Point[numPoints + 1];
        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 + 1; i++)
        {
            pts [i] = new Point(
                Convert.ToInt32(cx + rx * Math.Cos(theta)),
                Convert.ToInt32(cy + ry * Math.Sin(theta)));
            theta += dtheta;
        }
        d.DrawPolyLine(pts, c);
    }