我在 VB6 中遇到双显示器问题,请帮我查一下以下任何一个。
目前我正在使用VB6中现有的属性。
Screen.Width
& Screen.Height
只给出了主监视器的宽度和高度。
答案 0 :(得分:3)
您必须使用Windows API来确定多显示器设置的虚拟屏幕大小:
Private Const SM_CXVIRTUALSCREEN = 78
Private Const SM_CYVIRTUALSCREEN = 79
Private Const SM_CMONITORS = 80
Private Const SM_SAMEDISPLAYFORMAT = 81
Private Declare Function GetSystemMetrics Lib "user32" ( _
ByVal nIndex As Long) As Long
Public Property Get VirtualScreenWidth() As Long
VirtualScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN)
End Property
Public Property Get VirtualScreenHeight() As Long
VirtualScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN)
End Property
Public Property Get DisplayMonitorCount() As Long
DisplayMonitorCount = GetSystemMetrics(SM_CMONITORS)
End Property
Public Property Get AllMonitorsSame() As Long
AllMonitorsSame = GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
End Property