确定屏幕分辨率 您可以用下面给出这一小段代码检测当前屏幕分辨率,然后根据结果作出反应──例如,重新调整窗体大小以适应用程序户分辨率。 Public Function CheckRez(pixelWidth As Long, pixelHeight As Long) As Boolean 注释: Dim lngTwipsX As Long Dim lngTwipsY As Long 注释: 注释: convert pixels to twips lngTwipsX = pixelWidth * 15 lngTwipsY = pixelHeight * 15 注释: 注释: check against current settings If lngTwipsX <> Screen.Width Then CheckRez = False Else If lngTwipsY <> Screen.Height Then CheckRez = False Else CheckRez = True End If End If 注释: End Function Next, run the following code at the start of the program: If CheckRez(640, 480) = False Then MsgBox "Incorrect screen size!" Else MsgBox "Screen Resolution Matches!" End If