RECT
struct RECT
The RECT structure defines a rectangle by the coordinates of its upper-left and lower-right corners.
using System.CodeDom.Compiler;
using System.Drawing;
using System.Runtime.CompilerServices;
namespace Windows.Win32.Foundation
{
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.106+a37a0b4b70")]
internal struct RECT
{
internal int left;
internal int top;
internal int right;
internal int bottom;
internal int Width {
[IsReadOnly]
get {
return right - left;
}
}
internal int Height {
[IsReadOnly]
get {
return bottom - top;
}
}
internal bool IsEmpty {
[IsReadOnly]
get {
if (left == 0 && top == 0 && right == 0)
return bottom == 0;
return false;
}
}
internal int X {
[IsReadOnly]
get {
return left;
}
}
internal int Y {
[IsReadOnly]
get {
return top;
}
}
internal Size Size {
[IsReadOnly]
get {
return new Size(Width, Height);
}
}
public RECT(Size size)
{
left = 0;
top = 0;
right = size.Width;
bottom = size.Height;
}
[IsReadOnly]
[NullableContext(1)]
public override string ToString()
{
return ((Rectangle)this).ToString();
}
internal RECT(Rectangle value)
{
this = new RECT(value.Left, value.Top, value.Right, value.Bottom);
}
internal RECT(Point location, Size size)
{
this = new RECT(location.X, location.Y, location.X + size.Width, location.Y + size.Height);
}
internal RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
internal static RECT FromXYWH(int x, int y, int width, int height)
{
return new RECT(x, y, x + width, y + height);
}
public static implicit operator Rectangle(RECT value)
{
return new Rectangle(value.left, value.top, value.Width, value.Height);
}
public static implicit operator RectangleF(RECT value)
{
return new RectangleF((float)value.left, (float)value.top, (float)value.Width, (float)value.Height);
}
public static implicit operator RECT(Rectangle value)
{
return new RECT(value);
}
}
}