Exemple #1
0
        public void Draw(Mainfigure figure, Graphics g)
        {
            PointF first  = new PointF(figure.Point1.X, figure.Point1.Y);
            PointF second = new PointF(figure.Point2.X, figure.Point2.Y);

            g.DrawLine(figure.pen, first, second);
        }
        public void Draw(Mainfigure figure, Graphics g)
        {
            PointF first  = new PointF(figure.Point1.X, figure.Point1.Y);
            PointF second = new PointF(figure.Point2.X, figure.Point2.Y);

            if (second.X > first.X && second.Y > first.Y)
            {
                g.DrawRectangle(figure.pen, first.X, first.Y, second.X - first.X, second.Y - first.Y);
            }
            else
            if (first.X > second.X && second.Y > first.Y)
            {
                g.DrawRectangle(figure.pen, second.X, first.Y, first.X - second.X, second.Y - first.Y);
            }
            else
            if (first.X > second.X && first.Y > second.Y)
            {
                g.DrawRectangle(figure.pen, second.X, second.Y, first.X - second.X, first.Y - second.Y);
            }
            else
            if (second.X > first.X && first.Y > second.Y)
            {
                g.DrawRectangle(figure.pen, first.X, second.Y, second.X - first.X, first.Y - second.Y);
            }
        }
Exemple #3
0
        public void Draw(Mainfigure figure, Graphics g)
        {
            Point first  = new Point(figure.Point1.X, figure.Point1.Y);
            Point second = new Point(figure.Point2.X, figure.Point2.Y);

            if (second.X > first.X && second.Y > first.Y)
            {
                g.DrawEllipse(figure.pen, first.X, first.Y, second.X - first.X, second.X - first.X);
            }
            else
            if (first.X > second.X && second.Y > first.Y)
            {
                g.DrawEllipse(figure.pen, second.X, first.Y, first.X - second.X, first.X - second.X);
            }
            else
            if (first.X > second.X && first.Y > second.Y)
            {
                g.DrawEllipse(figure.pen, second.X, second.Y, first.X - second.X, first.X - second.X);
            }
            else
            {
                g.DrawEllipse(figure.pen, first.X, second.Y, second.X - first.X, second.X - first.X);
            }
        }
Exemple #4
0
        public void Draw(Mainfigure figure, Graphics g)
        {
            PointF first  = new PointF(figure.Point1.X, figure.Point1.Y);
            PointF second = new PointF(figure.Point2.X, figure.Point2.Y);
            PointF third  = new PointF(0, 0);

            if (second.X > first.X && second.Y > first.Y)
            {
                third.X = second.X - 2 * (second.X - first.X);
                third.Y = second.Y;
            }
            else
            if (first.X > second.X && second.Y > first.Y)
            {
                third.X = second.X + 2 * (first.X - second.X);
                third.Y = second.Y;
            }
            else
            if (first.X > second.X && first.Y > second.Y)
            {
                third.X = second.X + 2 * (first.X - second.X);
                third.Y = second.Y;
            }
            else
            if (second.X > first.X && first.Y > second.Y)
            {
                third.X = second.X - 2 * (second.X - first.X);
                third.Y = second.Y;
            }
            List <PointF> parray = new List <PointF>();

            parray.Add(first);
            parray.Add(second);
            parray.Add(third);
            g.DrawPolygon(figure.pen, parray.ToArray());
        }
Exemple #5
0
 public void Draw(Mainfigure figure, Graphics g)
 {
     g.DrawEllipse(figure.pen, figure.Point1.X, figure.Point1.Y, figure.Point2.X - figure.Point1.X, figure.Point2.Y - figure.Point1.Y);
 }