Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Rect Constructor (Double, Double, Double, Double)

.NET Framework 4.5

Initializes a Rect structure that has the specified x-coordinate, y-coordinate, width, and height.

Namespace:  Windows.Foundation
Assembly:  System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)

public Rect(
	double x,
	double y,
	double width,
	double height
)

Parameters

x
Type: System.Double

The x-coordinate of the top-left corner of the rectangle.

y
Type: System.Double

The y-coordinate of the top-left corner of the rectangle.

width
Type: System.Double

The width of the rectangle.

height
Type: System.Double

The height of the rectangle.

ExceptionCondition
ArgumentException

width or height are less than 0.

NoteNote

width and height can be negative if they are specified in XAML as part of the attribute string, with the result that the direction that the width or height applies to is inverted. For instance, a height of -20 will produce a Rect where the X,Y point is now the bottom left corner. However, the Rect constructor in managed code does not permit negative values for width and height. You should adjust the coordinate reference of x,y, width and height such that the Rect can be specified using non-negative width and height values.

Supported in: Windows Phone Silverlight 8
Show:
© 2014 Microsoft