zoukankan      html  css  js  c++  java
  • SWT中如何居中显示?

            // 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);

  • 相关阅读:
    BD String
    1114
    1083
    1084
    1108
    1087
    1145
    1217
    1164
    反射
  • 原文地址:https://www.cnblogs.com/huqingyu/p/605440.html
Copyright © 2011-2022 走看看