Partager via


Sys.UI.Bounds Class

Creates an object that contains a set of integer coordinates representing position, width, and height.

Namespace: Sys.UI

Inherits: None

var objectBoundsVar = new Sys.UI.Bounds(x, y, width, height);

Constructors

Name

Description

Sys.UI.Bounds Constructor

Initializes a new instance of the Sys.UI.Bounds class.

Members

Name

Description

Sys.UI.Bounds height Property

Gets the height of the Bounds object in pixels.

Sys.UI.Bounds width Property

Gets the width of the Bounds object in pixels.

Sys.UI.Bounds x Property

Gets the x-coordinate of the Bounds object in pixels.

Sys.UI.Bounds y Property

Gets the y-coordinate the Bounds object in pixels.

Remarks

The getBounds method of the Sys.UI.DomElement class returns a Bounds object.

Example

The following example shows how to use the Bounds class.

// Get the bounds of the element
var elementRef = $get("Label1");
var elementBounds = Sys.UI.DomElement.getBounds(elementRef);
var result = '';
result += "Label1 bounds x = " + elementBounds.x + "<br/>";
result += "Label1 bounds y = " + elementBounds.y + "<br/>";
result += "Label1 bounds width = " + elementBounds.width + "<br/>";
result += "Label1 bounds height = " + elementBounds.height + "<p/>";
// Get the bounds of the element
var elementRef = $get("Label1");
var elementBounds = Sys.UI.DomElement.getBounds(elementRef);
var result = '';
result += "Label1 bounds x = " + elementBounds.x + "<br/>";
result += "Label1 bounds y = " + elementBounds.y + "<br/>";
result += "Label1 bounds width = " + elementBounds.width + "<br/>";
result += "Label1 bounds height = " + elementBounds.height + "<p/>";

See Also

Reference

new Operator

Other Resources

Language Reference