예제 #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);
 }
예제 #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);
        }
    }
예제 #3
0
 public abstract void Draw(GeneralGraphics Canvas);
예제 #4
0
 public override void Draw(GeneralGraphics Canvas)
 {
     Canvas.DrawEllipse(color, this.x, this.y, this.size, this.size);
 }