RECT

This content has moved to another location. See RECT for the latest version.

Tags :


Community Content

Noelle Mallory - MSFT
VB9: Possible implementation of the RECT structure
        ''' <summary>The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.</summary>
''' <remarks>By convention, the right and bottom edges of the rectangle are normally considered exclusive. In other words, the pixel whose coordinates are (right, bottom) lies immediately outside of the the rectangle. For example, when RECT is passed to the FillRect function, the rectangle is filled up to, but not including, the right column and bottom row of pixels. This structure is identical to the RECTL structure.</remarks>
<StructLayout(LayoutKind.Sequential)> _
Friend Structure RECT
''' <summary>Specifies the x-coordinate of the upper-left corner of the rectangle.</summary>
Friend Left As Int32
''' <summary>Specifies the y-coordinate of the upper-left corner of the rectangle.</summary>
Friend Top As Int32
''' <summary>Specifies the x-coordinate of the lower-right corner of the rectangle.</summary>
Friend Right As Int32
''' <summary>Specifies the y-coordinate of the lower-right corner of the rectangle.</summary>
Friend Bottom As Int32
''' <summary>Initializes <see cref="RECT"/> structure</summary>
''' <param name="Left">Specifies the x-coordinate of the upper-left corner of the rectangle.</param>
''' <param name="Top">Specifies the y-coordinate of the upper-left corner of the rectangle.</param>
''' <param name="Right">Specifies the x-coordinate of the lower-right corner of the rectangle.</param>
''' <param name="Bottom">Specifies the y-coordinate of the lower-right corner of the rectangle.</param>
Friend Sub New(ByVal Left%, ByVal Top%, ByVal Right%, ByVal Bottom%)
Me.Left = Left : Me.Bottom = Bottom : Me.Right = Right : Me.Top = Top
End Sub
''' <summary>Converts <see cref="Rectangle"/> to <see cref="RECT"/></summary>
''' <param name="a">A <see cref="Rectangle"/></param>
''' <returns><see cref="RECT"/> equivalent to <paramref name="a"/></returns>
Public Shared Widening Operator CType(ByVal a As Rectangle) As RECT
Return New RECT(a.Left, a.Top, a.Right, a.Bottom)
End Operator
''' <summary>Converts <see cref="RECT"/> to <see cref="Rectangle"/></summary>
''' <param name="a">A <see cref="RECT"/></param>
''' <returns><see cref="Rectangle"/> equivalent to <paramref name="a"/></returns>
Public Shared Widening Operator CType(ByVal a As RECT) As Rectangle
Return New Rectangle(a.Left, a.Top, a.Right - a.Left, a.Bottom - a.Top)
End Operator
End Structure

Page view tracker