From 4be5cef3efecf86376d9f28ba878dc3dd9871de9 Mon Sep 17 00:00:00 2001 From: Jeremy Pritts <49847914+ds5678@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:09:19 -0400 Subject: [PATCH] Add implicit conversions to System.Drawing structs. --- src/ElectronNET.API/Entities/Point.cs | 9 +++++++++ src/ElectronNET.API/Entities/Rectangle.cs | 9 +++++++++ src/ElectronNET.API/Entities/Size.cs | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/src/ElectronNET.API/Entities/Point.cs b/src/ElectronNET.API/Entities/Point.cs index a464bed5..9b3bed8a 100644 --- a/src/ElectronNET.API/Entities/Point.cs +++ b/src/ElectronNET.API/Entities/Point.cs @@ -20,5 +20,14 @@ public class Point /// The y. /// public int Y { get; set; } + + /// + /// Convert this to . + /// + /// The point. + public static implicit operator System.Drawing.Point(Point point) + { + return new System.Drawing.Point(point.X, point.Y); + } } } \ No newline at end of file diff --git a/src/ElectronNET.API/Entities/Rectangle.cs b/src/ElectronNET.API/Entities/Rectangle.cs index 5d171e76..b0622725 100644 --- a/src/ElectronNET.API/Entities/Rectangle.cs +++ b/src/ElectronNET.API/Entities/Rectangle.cs @@ -36,5 +36,14 @@ public class Rectangle /// The height. /// public int Height { get; set; } + + /// + /// Convert this to . + /// + /// The rectangle. + public static implicit operator System.Drawing.Rectangle(Rectangle rectangle) + { + return new System.Drawing.Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + } } } \ No newline at end of file diff --git a/src/ElectronNET.API/Entities/Size.cs b/src/ElectronNET.API/Entities/Size.cs index d63d1800..61bbd122 100644 --- a/src/ElectronNET.API/Entities/Size.cs +++ b/src/ElectronNET.API/Entities/Size.cs @@ -20,5 +20,14 @@ public class Size /// The height. /// public int Height { get; set; } + + /// + /// Convert this to . + /// + /// The size. + public static implicit operator System.Drawing.Size(Size size) + { + return new System.Drawing.Size(size.Width, size.Height); + } } } \ No newline at end of file