[StructLayout(LayoutKind.Sequential)]
struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public RECT(int left, int top, int right, int bottom)
{
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
// Handy method for converting to a System.Drawing.Rectangle
public Rectangle Rectangle
{
// this isn't correct ...
get { return new Rectangle(this.left, this.top, this.right, this.bottom); }
// the correct form is this :
get { return new Rectangle(this.left, this.top, this.right - this.left, this.bottom - this.top) }
}
}
Structure RECT
Public Left, Top, Right, Bottom As Int32
End Structure
This can be used when a PInvoke signature requires a "Win32 rectangle," otherwise you should be using System.Drawing.Rectangle.