A convenient Line object.
Beispiel #1
0
 /// <summary>
 /// Creates a line from another line.
 /// </summary>
 /// <param name="copy">The other line to copy from.</param>
 public Line(Line copy)
     : this(copy._x1, copy._y1, copy._x2, copy._y2)
 {
 }
Beispiel #2
0
        /// <summary>
        /// Grabs the area of a Line.
        /// </summary>
        /// <param name="l">The line to convert</param>
        /// <returns>A System.Drawing.Rectangle of the area of this Line.</returns>
        public static Rectangle ToRectangle(Line l)
        {
            Line copy = new Line(l);

            if (l._x2 < l._x1) { copy._x1 = l._x2; copy._x2 = l._x1; }
            if (l._y2 < l._y1) { copy._y1 = l._y2; copy._y2 = l._y1; }

            int w = copy._x2 - copy._x1;
            int h = copy._y2 - copy._y1;
            return new Rectangle(copy._x1, copy._y1, w, h);
        }