更新:2007 年 11 月
创建一个对象,该对象包含一组表示位置的整数坐标。
命名空间:Sys.UI
**继承:**无
var objectPointVar = new Sys.UI.Point(x, y);
构造函数
名称 |
说明 |
|---|---|
初始化 Point 类的新实例。 |
成员
名称 |
说明 |
|---|---|
获取 Point 对象的 x 坐标(以像素为单位)。此属性为只读。 |
|
获取 Point 对象的 y 坐标(以像素为单位)。此属性为只读。 |
备注
Sys.UI.DomElement 类的 getLocation 方法返回一个 Point 对象。
示例
下面的代码示例演示如何使用 Point 类。
// Get the location of the element
var elementLoc = Sys.UI.DomElement.getLocation(elementRef);
result += "Before move - Label1 location (x,y) = (" +
elementLoc.x + "," + elementLoc.y + ")<br/>";
// Move the element
Sys.UI.DomElement.setLocation(elementRef, 100, elementLoc.y);
elementLoc = Sys.UI.DomElement.getLocation(elementRef);
result += "After move - Label1 location (x,y) = (" +
elementLoc.x + "," + elementLoc.y + ")<br/>";
// Get the location of the element
var elementLoc = Sys.UI.DomElement.getLocation(elementRef);
result += "Before move - Label1 location (x,y) = (" +
elementLoc.x + "," + elementLoc.y + ")<br/>";
// Move the element
Sys.UI.DomElement.setLocation(elementRef, 100, elementLoc.y);
elementLoc = Sys.UI.DomElement.getLocation(elementRef);
result += "After move - Label1 location (x,y) = (" +
elementLoc.x + "," + elementLoc.y + ")<br/>";