Example #1
0
    public override void Draw(Visualization Canvas)
    {
        Pen pen = new Pen(Color.Black);

        Canvas.DrawLine(pen, x, y, x + width, y);
        Canvas.DrawLine(pen, x + width, y, x + width, y + height);
        Canvas.DrawLine(pen, x + width, y + height, x, y + height);
        Canvas.DrawLine(pen, x, y + height, x, y);
    }
Example #2
0
    public override void Draw(Visualization Canvas)
    {
        Pen pen = new Pen(Color.Black);

        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(pen, pts[i].X,
                            pts[i].Y,
                            pts[(i + 1) % numPoints].X,
                            pts[(i + 1) % numPoints].Y);
        }
    }
Example #3
0
        /// <summary>
        /// Zeichne eine Linie in den Graphen
        /// </summary>
        /// <param name="graphStart">Start-Koordinate</param>
        /// <param name="graphEnd">End-Koordinate</param>
        /// <param name="fillColor">Füllfarbe</param>
        /// <param name="is_redraw"><para>True: Linie wird nicht gespeichert</para><para></para><para>False: Linie wird gespeichert</para></param>
        public void PlotLine(GraphCoord graphStart, GraphCoord graphEnd, Color fillColor, bool is_redraw = false)
        {
            if (!is_redraw && RememberDrawing)
            {
                LineMemory.Add(new SimpleLine(graphStart, graphEnd, fillColor));
            }
            ImageCoord start = Graph2Image(graphStart);
            ImageCoord end   = Graph2Image(graphEnd);

            Visualization.DrawLine(start, end, fillColor);
        }