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 |
---|---|
Initializes a new instance of the Sys.UI.Bounds class. |
Members
Name |
Description |
---|---|
Gets the height of the Bounds object in pixels. |
|
Gets the width of the Bounds object in pixels. |
|
Gets the x-coordinate of the Bounds object in pixels. |
|
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/>";