Merge pull request #801 from ds5678/primitive-implicit-conversions

Implicit Conversions to System.Drawing structs
This commit is contained in:
Florian Rappl
2024-04-29 11:42:45 +02:00
committed by GitHub
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);
}
}
}