Control的几个较重要的方法
1.control.toDisplay(x,y)
方法原型:
/**
Returns a point which is the result of converting the argument, which is specified in coordinates relative to
the receiver, to display relative coordinates
*/
public Point toDisplay (int x, int y) {
checkWidget ();
POINT pt = new POINT ();
pt.x = x; pt.y = y;
OS.ClientToScreen (handle, pt);
return new Point (pt.x, pt.y);
}
将x,y由Control的相对值转化为Display(屏幕)的绝对值。 这个方法在平时用得较多。
2.Control类:
control.toControl ( Point point)
Returns a point which is the result of converting the argument, which is specified in display relative coordinates,
to coordinates relative to the receiver.
将 Point 由 Display 的绝对值转化为 Control 的相对值。