Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

RECT (Structures)
 
.
Summary
TODO - a short description

C# Signature:

    [Serializable, StructLayout(LayoutKind.Sequential)]
    public struct RECT {
      public int Left;
      public int Top;
      public int Right;
      public int Bottom;

      public RECT(int left_, int top_, int right_, int bottom_) {
        Left = left_;
        Top = top_;
        Right = right_;
        Bottom = bottom_;
      }

      public int Height { get { return Bottom - Top; } }
      public int Width { get { return Right - Left; } }
      public Size Size { get { return new Size(Width, Height); } }

      public Point Location { get { return new Point(Left, Top); } }

      // Handy method for converting to a System.Drawing.Rectangle
      public Rectangle ToRectangle()
        { return Rectangle.FromLTRB(Left, Top, Right, Bottom); }

      public static RECT FromRectangle(Rectangle rectangle) {
        return new RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom);
      }

      public override int GetHashCode() {
        return Left ^ ((Top << 13) | (Top >> 0x13))
          ^ ((Width << 0x1a) | (Width >> 6))
          ^ ((Height << 7) | (Height >> 0x19));
      }
    }

VB .NET Signature:

<StructLayout(LayoutKind.Sequential)> _
Public Structure RECT
   Public Left As Integer
   Public Top As Integer
   Public Right As Integer
   Public Bottom As Integer
End Structure

Public Shared Function ToRectangle(ByVal sourceRect As RECT) As Rectangle
   Return New Rectangle(sourceRect.Left, sourceRect.Top, sourceRect.Right - sourceRect.Left, sourceRect.Bottom - sourceRect.Top)
End Function

User-Defined Types:

None.

Notes:

The Win32 RECT structure is not compatible with the .NET System.Drawing.Rectangle structure.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

TODO

Documentation
RECT on MSDN

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions