Udostępnij za pośrednictwem


RectHelper Class

Definition

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

public ref class RectHelper sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class RectHelper final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class RectHelper
Public NotInheritable Class RectHelper
Inheritance
Object Platform::Object IInspectable RectHelper
Attributes

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# code can use members of Rect instead, because utility members are available directly on the structure due to .NET 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 C# developer could use directly on Rect are available in a static form on the RectHelper class.

Properties

Empty

Gets a static Rect value where the Rect has no size or position. C# code should use Rect.Empty instead.

Methods

Contains(Rect, Point)

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

Equals(Rect, Rect)

Provides comparison of the values of two Rect values. C# code should use the Equality (=) operator or Equals method instead.

FromCoordinatesAndDimensions(Single, Single, Single, Single)

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

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# code should use the Rect(Point,Size) constructor instead.

FromPoints(Point, Point)

Creates a new Rect value based on two points. C# code should use the Rect(Point,Point) constructor instead.

GetBottom(Rect)

Gets a "Bottom" value for the specified Rect. So long as the Rect is not the Empty Rect, "Bottom" is evaluated as Y + Height. C# code should use Rect.Bottom instead.

GetIsEmpty(Rect)

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

GetLeft(Rect)

Gets a "Left" value for the specified Rect. So long as the Rect is not the Empty Rect, "Left" is evaluated as X. C# code should use Rect.Left instead.

GetRight(Rect)

Gets a "Right" value for the specified Rect. So long as the Rect is not the Empty Rect, "Right" is evaluated as X + Width. C# code should use Rect.Right instead.

GetTop(Rect)

Gets a "Top" value for the specified Rect. So long as the Rect is not the Empty Rect, "Top" is evaluated as Y. C# code should use Rect.Top instead.

Intersect(Rect, Rect)

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

Union(Rect, Point)

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

Union(Rect, Rect)

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

Applies to

See also