代码是text1.text = screen.width \screen.twipsperpixe1x &"*"& screen.height \screen.twipsperpixe1y
 如果os是2K+sp6 分辨率是1024*768,运行时,生成EXE后都是正常的,分辨率是800*600, 运行时  text1.text =600*600,生成EXE后正常.
 如果os是XP+SP2 都是正常的,请教高手知道一个所以然.谢谢!

解决方案 »

  1.   

    应该是BUG我用Screen的语句的时候,也会发生分辨率不正确问题。
      

  2.   

    你用这个代码,可以解决Screen的BUG。这是我做抓画面程序的时候的代阿。Private Declare Function GetDeviceCaps Lib "gdi32" _
       (ByVal hdc As Long, _
        ByVal nIndex As Long) As LongPrivate Const HORZRES As Long = 8
    Private Const VERTRES As Long = 10
    Private Const BITSPIXEL As Long = 12
    Private Const VREFRESH As Long = 116
    Public Function ReturnResolution() As String   Dim currHRes As Long
       Dim currVRes As Long   
       currHRes = GetDeviceCaps(hdc, HORZRES)
       currVRes = GetDeviceCaps(hdc, VERTRES)   ReturnResolution = currHRes & "X" & currVRes   
    End Function
      

  3.   

    这样就解决了
    text1.text = screen.width \15 & "*" & screen.height \ 15
      

  4.   

    Screen.Width \ Screen.TwipsPerPixelX 是正统的用法, 并没错误, \15 一般人都在用也没问题, 你的问题只在于你自己的疏忽.text1.text = screen.width \screen.twipsperpixe1x &"*"& screen.height \screen.twipsperpixe1y 上面这行是你打的, 下面这行是我打的, 请你用放大镜看一下, 你那个字母打错了.Text1.Text = Screen.Width \ Screen.TwipsPerPixelX & "*" & Screen.Height \ Screen.TwipsPerPixelY
      

  5.   

    用API吧。
    GetSystemMetrics(SM_CXSCREEN)
    GetSystemMetrics(SM_CYSCREEN)这个应该错不了。