我在
1024×768 

ScreenWidth = Screen.Width / Screen.TwipsPerPixelX
    ScreenHeight = Screen.Height / Screen.TwipsPerPixelYScreenWidth = ScreenWidth = 768在800×600
中 
ScreenWidth = ScreenWidth = 600这是为什么?
难道我的显示器是正方姓的???

解决方案 »

  1.   

    程序是 SDI , 第一次是在 form 中定义,在form load 运行的
    Dim ScreenWidth As Integer
    Dim ScreenHeight As IntegerScreenWidth = Screen.Width / Screen.TwipsPerPixelX
    ScreenHeight = Screen.Height / Screen.TwipsPerPixelY后来我改在 模块中定义, main 中运行
    也是一样
      

  2.   

    Option ExplicitPrivate Sub Command1_Click()
    Dim ScreenWidth As Integer
    Dim ScreenHeight As IntegerScreenWidth = Screen.Width / Screen.TwipsPerPixelX
    ScreenHeight = Screen.Height / Screen.TwipsPerPixelY
    Debug.Print ScreenWidth
    Debug.Print ScreenHeightEnd SubPrivate Sub Form_Load()
    Dim ScreenWidth As Integer
    Dim ScreenHeight As IntegerScreenWidth = Screen.Width / Screen.TwipsPerPixelX
    ScreenHeight = Screen.Height / Screen.TwipsPerPixelY
    Debug.Print ScreenWidth
    Debug.Print ScreenHeightEnd Sub
    --------------------------------------
     1024 
     768 
     1024 
     768