浙林龙哥

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
        // Get the resolution
Rectangle pDisplayBounds = getShell().getDisplay().getBounds();

          // Set Width and Height(doesn't matter value)
nWidth = pDisplayBounds.width  / 2;
nHeight = pDisplayBounds.height / 2;

           // This formulae calculate the shell's Left ant Top
int nLeft = (pDisplayBounds.width - nMinWidth) / 2;
int nTop = (pDisplayBounds.height - nMinHeight) / 2;
               
            // Set shell bounds,
getShell().setBounds(nLeft, nTop, nMinWidth, nMinHeight);

posted on 2006-12-27 22:12  浙林龙哥  阅读(1250)  评论(0编辑  收藏  举报