Feeling

    三人行,必有我师焉

   ::  :: 新随笔 :: 联系 ::  :: 管理 ::
  185 随笔 :: 0 文章 :: 392 评论 :: 0 Trackbacks
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 的相对值。

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}

 

posted on 2006-06-20 17:54 三人行,必有我师焉 阅读(756) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
GitHub |  开源中国社区 |  maven仓库 |  文件格式转换