Udostępnij za pośrednictwem


RectHelper Class

Definition

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

public ref class RectHelper sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 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(Windows.Foundation.UniversalApiContract), 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

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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

Empty

Gets a static Rect value where the Rect has no size or position. C# and Microsoft Visual Basic 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# and Microsoft Visual Basic code should use Rect.Contains instead.

Equals(Rect, Rect)

Provides comparison of the values of two Rect values. C# and Microsoft Visual Basic 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# and Microsoft Visual Basic 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# and Microsoft Visual Basic code should use the Rect(Point,Size) constructor instead.

FromPoints(Point, Point)

Creates a new Rect value based on two points. C# and Microsoft Visual Basic 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# and Microsoft Visual Basic code should use Rect.Bottom instead.

GetIsEmpty(Rect)

Returns whether a specified Rect is equivalent to an Empty Rect. C# and Microsoft Visual Basic 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# and Microsoft Visual Basic 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# and Microsoft Visual Basic 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# and Microsoft Visual Basic code should use Rect.Top instead.

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 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# and Microsoft Visual Basic 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# and Microsoft Visual Basic code should use Rect.Union(Rect) instead.

Applies to

See also