Add implicit conversions to System.Drawing structs.

This commit is contained in:
Jeremy Pritts
2023-08-24 21:09:19 -04:00
parent 77b7141513
commit 4be5cef3ef
3 changed files with 27 additions and 0 deletions

View File

@@ -20,5 +20,14 @@
/// The y.
/// </value>
public int Y { get; set; }
/// <summary>
/// Convert this <see cref="Point"/> to <see cref="System.Drawing.Point"/>.
/// </summary>
/// <param name="point">The point.</param>
public static implicit operator System.Drawing.Point(Point point)
{
return new System.Drawing.Point(point.X, point.Y);
}
}
}

View File

@@ -36,5 +36,14 @@
/// The height.
/// </value>
public int Height { get; set; }
/// <summary>
/// Convert this <see cref="Rectangle"/> to <see cref="System.Drawing.Rectangle"/>.
/// </summary>
/// <param name="rectangle">The rectangle.</param>
public static implicit operator System.Drawing.Rectangle(Rectangle rectangle)
{
return new System.Drawing.Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
}
}
}

View File

@@ -20,5 +20,14 @@
/// The height.
/// </value>
public int Height { get; set; }
/// <summary>
/// Convert this <see cref="Size"/> to <see cref="System.Drawing.Size"/>.
/// </summary>
/// <param name="size">The size.</param>
public static implicit operator System.Drawing.Size(Size size)
{
return new System.Drawing.Size(size.Width, size.Height);
}
}
}