Класс Sys.UI.Bounds

Создает объект, содержащий набор координат, которые выражены целыми числами и представляют позицию, ширину и высоту.

Пространство имен: Sys.UI

Наследования: отсутствуют

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

Конструкторы

Имя

Описание

Конструктор Sys.UI.Bounds

Инициализирует новый экземпляр класса Sys.UI.Bounds.

Члены

Имя

Описание

Свойство Sys.UI.Bounds height

Получает высоту объекта Bounds в точках.

Свойство Sys.UI.Bounds width

Получает ширину объекта Bounds в точках.

Свойство Sys.UI.Bounds x

Получает Х-координату объекта Bounds в точках.

Свойство Sys.UI.Bounds y

Получает Y-координату объекта Bounds в точках.

Заметки

Метод getBounds класса Sys.UI.DomElement возвращает объект Bounds.

Пример

В следующем примере показано, как использовать класс Bounds.


// 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/>";

См. также

Ссылки

Оператор new

Другие ресурсы

Справочник по языку