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
的相對值。
toDisplay
(
Point
?point)
??????????Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates.
將
Point
由
Control
的相對值轉化為
Display
的絕對值。
Example:?
?Button button =
new
Button( s, SWT.
BORDER
);
?System.
out
.println( button.getLocation( ) );
//Point {0, 0}
?
?System.
out
.println( button.toDisplay( button.getLocation( ) ) );
//Point {70, 89}
?
?System.
out
.println( button.toControl( button.toDisplay( button.getLocation( ) ) ) );
//Point {0, 0}
Device類:getDepth
()
??????????Returns the bit depth of the screen, which is the number of bits it takes to represent the number of unique colors that the screen is currently capable of displaying.
拿到操作系統的顏色深度。?
getDPI()
??????????Returns a point whose x coordinate is the horizontal dots per inch of the display, and whose y coordinate is the vertical dots per inch of the display.
拿到操作系統的DPI值。
Example:
?System.out.println(Display.getDefault( ).getDepth( ));//32
?System.out.println(Display.getDefault( ).getDPI( ));//Point {96, 96}
?