RectHelper RectHelper RectHelper Class

Provides helper methods to evaluate or set Rect values. C# and Microsoft Visual Basic code should use members of Rect instead.

Syntax

Declaration

public sealed class RectHelperpublic sealed class RectHelperPublic NotInheritable Class RectHelper

Remarks

Rect is a Windows Runtime structure that represents a rectangle's dimensions with an origin.

RectHelper is one of several Helper classes that are intended to provide utility methods for Windows Runtime structure values. C# and Microsoft Visual Basic code can use members of Rect instead, because utility members are available directly on the structure due to .NET Framework runtime support. C++ code can only access the data values on Rect, for example Left. For C++ developers, approximately the same utility features that a Microsoft Visual Basic developer could use directly on Rect are available in a static form on the RectHelper class.

Properties summary

Gets a static Rect value where the Rect has no size or position (all values 0). C# and Microsoft Visual Basic code should use Empty instead.

Methods summary

Returns whether a given Point is within the bounds of a given Rect, for a shared coordinate reference. C# and Microsoft Visual Basic code should use Contains instead. C# and Microsoft Visual Basic code should use the = operator instead.

Provides comparison of the values of two Rect values. C# and Microsoft Visual Basic code should use the = operator instead.

Creates a new Rect value based on the element values of a Rect structure. C# and Microsoft Visual Basic code should use Rect(Double,Double,Double,Double) instead.

Creates a new Rect value based on a Point that specifies the upper-left origin, and a Size that specifies the width and height. C# and Microsoft Visual Basic code should use Rect(Point,Size) instead.

Creates a new Rect value based on two points. C# and Microsoft Visual Basic code should use Rect(Point,Point) instead.

Gets a "Bottom" value for the specified Rect. So long as Height is positive, "Bottom" is evaluated as Y + Height. C# and Microsoft Visual Basic code should use Bottom instead.

Returns whether a specified Rect is equivalent to an Empty Rect. C# and Microsoft Visual Basic code should use IsEmpty instead.

Gets a "Left" value for the specified Rect. So long as Width is positive, "Left" is evaluated as X. C# and Microsoft Visual Basic code should use Left instead.

Gets a "Right" value for the specified Rect. So long as Width is positive, "Right" is evaluated as X + Width. C# and Microsoft Visual Basic code should use Right instead.

Gets a "Top" value for the specified Rect. So long as Height is positive, "Top" is evaluated as Y. C# and Microsoft Visual Basic code should use Top instead.

Returns the areas of two specified Rect values that intersect, as a new Rect. C# and Microsoft Visual Basic code should use Intersect instead.

Creates a rectangle that is exactly large enough to contain the a specified rectangle and a specified point. C# and Microsoft Visual Basic code should use Union(Point) instead.

Creates a rectangle that is exactly large enough to contain the two specified rectangles. C# and Microsoft Visual Basic code should use Union(Rect) instead.

Properties

  • Empty
    Empty
    Empty
    Empty

    Gets a static Rect value where the Rect has no size or position (all values 0). C# and Microsoft Visual Basic code should use Empty instead.

    public static Rect Empty { get; }public static Rect Empty { get; }Public Static ReadOnly Property Empty As Rectpublic static Rect Empty { get; }

    Property Value

Methods

  • Contains(Rect, Point)
    Contains(Rect, Point)
    Contains(Rect, Point)
    Contains(Rect, Point)

    Returns whether a given Point is within the bounds of a given Rect, for a shared coordinate reference. C# and Microsoft Visual Basic code should use Contains instead. C# and Microsoft Visual Basic code should use the = operator instead.

    public static bool Contains(Rect target, Point point)public static bool Contains(Rect target, Point point)Public Static Function Contains(target As Rect, point As Point) As boolpublic static bool Contains(Rect target, Point point)

    Parameters

    Returns

    • bool
      bool
      bool

      true if point is within the target bounds; otherwise, false.

  • Equals(Rect, Rect)
    Equals(Rect, Rect)
    Equals(Rect, Rect)
    Equals(Rect, Rect)

    Provides comparison of the values of two Rect values. C# and Microsoft Visual Basic code should use the = operator instead.

    public static bool Equals(Rect target, Rect value)public static bool Equals(Rect target, Rect value)Public Static Function Equals(target As Rect, value As Rect) As boolpublic static bool Equals(Rect target, Rect value)

    Parameters

    Returns

    • bool
      bool
      bool

      true if target and value hold equivalent values; otherwise, false.

  • FromCoordinatesAndDimensions(Single, Single, Single, Single)
    FromCoordinatesAndDimensions(Single, Single, Single, Single)
    FromCoordinatesAndDimensions(Single, Single, Single, Single)
    FromCoordinatesAndDimensions(Single, Single, Single, Single)

    Creates a new Rect value based on the element values of a Rect structure. C# and Microsoft Visual Basic code should use Rect(Double,Double,Double,Double) instead.

    public static Rect FromCoordinatesAndDimensions(Single x, Single y, Single width, Single height)public static Rect FromCoordinatesAndDimensions(Single x, Single y, Single width, Single height)Public Static Function FromCoordinatesAndDimensions(x As Single, y As Single, width As Single, height As Single) As Rectpublic static Rect FromCoordinatesAndDimensions(Single x, Single y, Single width, Single height)

    Parameters

    • x
      System.Single
      System.Single
      System.Single

      The pixel value to set for X.

    • y
      System.Single
      System.Single
      System.Single

      The pixel value to set for Y.

    • width
      System.Single
      System.Single
      System.Single

      The pixel value to set for Width.

    • height
      System.Single
      System.Single
      System.Single

      The pixel value to set for Height.

    Returns

  • FromLocationAndSize(Point, Size)
    FromLocationAndSize(Point, Size)
    FromLocationAndSize(Point, Size)
    FromLocationAndSize(Point, Size)

    Creates a new Rect value based on a Point that specifies the upper-left origin, and a Size that specifies the width and height. C# and Microsoft Visual Basic code should use Rect(Point,Size) instead.

    public static Rect FromLocationAndSize(Point location, Size size)public static Rect FromLocationAndSize(Point location, Size size)Public Static Function FromLocationAndSize(location As Point, size As Size) As Rectpublic static Rect FromLocationAndSize(Point location, Size size)

    Parameters

    Returns

  • FromPoints(Point, Point)
    FromPoints(Point, Point)
    FromPoints(Point, Point)
    FromPoints(Point, Point)

    Creates a new Rect value based on two points. C# and Microsoft Visual Basic code should use Rect(Point,Point) instead.

    public static Rect FromPoints(Point point1, Point point2)public static Rect FromPoints(Point point1, Point point2)Public Static Function FromPoints(point1 As Point, point2 As Point) As Rectpublic static Rect FromPoints(Point point1, Point point2)

    Parameters

    Returns

  • GetBottom(Rect)
    GetBottom(Rect)
    GetBottom(Rect)
    GetBottom(Rect)

    Gets a "Bottom" value for the specified Rect. So long as Height is positive, "Bottom" is evaluated as Y + Height. C# and Microsoft Visual Basic code should use Bottom instead.

    public static float GetBottom(Rect target)public static float GetBottom(Rect target)Public Static Function GetBottom(target As Rect) As floatpublic static float GetBottom(Rect target)

    Parameters

    Returns

    • float
      float
      float

      The evaluated "Bottom" value.

  • GetIsEmpty(Rect)
    GetIsEmpty(Rect)
    GetIsEmpty(Rect)
    GetIsEmpty(Rect)

    Returns whether a specified Rect is equivalent to an Empty Rect. C# and Microsoft Visual Basic code should use IsEmpty instead.

    public static bool GetIsEmpty(Rect target)public static bool GetIsEmpty(Rect target)Public Static Function GetIsEmpty(target As Rect) As boolpublic static bool GetIsEmpty(Rect target)

    Parameters

    Returns

    • bool
      bool
      bool

      true if the specified Rect is equivalent to an Empty Rect; otherwise, false.

  • GetLeft(Rect)
    GetLeft(Rect)
    GetLeft(Rect)
    GetLeft(Rect)

    Gets a "Left" value for the specified Rect. So long as Width is positive, "Left" is evaluated as X. C# and Microsoft Visual Basic code should use Left instead.

    public static float GetLeft(Rect target)public static float GetLeft(Rect target)Public Static Function GetLeft(target As Rect) As floatpublic static float GetLeft(Rect target)

    Parameters

    Returns

    • float
      float
      float

      The evaluated "Left" value.

  • GetRight(Rect)
    GetRight(Rect)
    GetRight(Rect)
    GetRight(Rect)

    Gets a "Right" value for the specified Rect. So long as Width is positive, "Right" is evaluated as X + Width. C# and Microsoft Visual Basic code should use Right instead.

    public static float GetRight(Rect target)public static float GetRight(Rect target)Public Static Function GetRight(target As Rect) As floatpublic static float GetRight(Rect target)

    Parameters

    Returns

    • float
      float
      float

      The evaluated "Right" value.

  • GetTop(Rect)
    GetTop(Rect)
    GetTop(Rect)
    GetTop(Rect)

    Gets a "Top" value for the specified Rect. So long as Height is positive, "Top" is evaluated as Y. C# and Microsoft Visual Basic code should use Top instead.

    public static float GetTop(Rect target)public static float GetTop(Rect target)Public Static Function GetTop(target As Rect) As floatpublic static float GetTop(Rect target)

    Parameters

    Returns

    • float
      float
      float

      The evaluated "Top" value.

  • Intersect(Rect, Rect)
    Intersect(Rect, Rect)
    Intersect(Rect, Rect)
    Intersect(Rect, Rect)

    Returns the areas of two specified Rect values that intersect, as a new Rect. C# and Microsoft Visual Basic code should use Intersect instead.

    public static Rect Intersect(Rect target, Rect rect)public static Rect Intersect(Rect target, Rect rect)Public Static Function Intersect(target As Rect, rect As Rect) As Rectpublic static Rect Intersect(Rect target, Rect rect)

    Parameters

    Returns

    • A Rect that represents the areas of target and rect that intersect. Can be an Empty value if there is no intersect.

  • Union(Rect, Point)
    Union(Rect, Point)
    Union(Rect, Point)
    Union(Rect, Point)

    Creates a rectangle that is exactly large enough to contain the a specified rectangle and a specified point. C# and Microsoft Visual Basic code should use Union(Point) instead.

    public static Rect Union(Rect target, Point point)public static Rect Union(Rect target, Point point)Public Static Function Union(target As Rect, point As Point) As Rectpublic static Rect Union(Rect target, Point point)

    Parameters

    Returns

    • A rectangle that is exactly large enough to contain the specified rectangle and point.

  • Union(Rect, Rect)
    Union(Rect, Rect)
    Union(Rect, Rect)
    Union(Rect, Rect)

    Creates a rectangle that is exactly large enough to contain the two specified rectangles. C# and Microsoft Visual Basic code should use Union(Rect) instead.

    public static Rect Union(Rect target, Rect rect)public static Rect Union(Rect target, Rect rect)Public Static Function Union(target As Rect, rect As Rect) As Rectpublic static Rect Union(Rect target, Rect rect)

    Parameters

    Returns

    • A rectangle that is exactly large enough to contain the two specified rectangles.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.dll