当前位置:编程学习 > VB >>

双屏。俩FORM。主屏运行一个FORM,副屏运行一个FORM。同时运行。怎么办

双屏。俩FORM。主屏运行一个FORM,副屏运行一个FORM。同时运行。怎么办 --------------------编程问答-------------------- 把双屏设为扩展屏幕,记着第二个屏幕的起始点,例如第一个屏幕为1024*768 第一个屏幕一般就是1025,0开始  

FormDisplay的属性面板中location设为1025,0

在FormMain的fromload事件中
FormDisplay.Show()


就行了 --------------------编程问答-------------------- 不错的构想,不是想炒股吧! --------------------编程问答-------------------- f2.left=f1.width --------------------编程问答-------------------- 什么怎么办?你问了什么问题? --------------------编程问答-------------------- 这样可以吗,还真的不知道啊。 --------------------编程问答-------------------- 这个是双屏代码,希望对您有用。
Public Const MONITORINFOF_PRIMARY = &H1
Public Const MONITOR_DEFAULTTONEAREST = &H2
Public Const MONITOR_DEFAULTTONULL = &H0
Public Const MONITOR_DEFAULTTOPRIMARY = &H1
Public Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Public Type MONITORINFO
    cbSize As Long
    rcMonitor As RECT
    rcWork As RECT
    dwFlags As Long
End Type

Public Declare Function GetMonitorInfo Lib "user32.dll" Alias "GetMonitorInfoA" _
    (ByVal hMonitor As Long, ByRef lpmi As MONITORINFO) As Long
Public Declare Function EnumDisplayMonitors Lib "user32.dll" (ByVal hdc As Long, _
    ByRef lprcClip As Any, ByVal lpfnEnum As Long, ByVal dwData As Long) As Long
Public Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As _
    Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal _
    bRepaint As Long) As Long

Sub Main()
    '先显示窗体
    Form1.Show
    Form2.Show
    '在枚举显示器来定位窗体
    EnumDisplayMonitors ByVal 0&, ByVal 0&, AddressOf MonitorEnumProc, ByVal 0&
End Sub

Public Function MonitorEnumProc(ByVal hMonitor As Long, ByVal hdcMonitor As Long, _
                                lprcMonitor As RECT, ByVal dwData As Long) As Long
    Dim MI As MONITORINFO, R As RECT
    MI.cbSize = Len(MI)
    GetMonitorInfo hMonitor, MI
    
    R = MI.rcWork
    If CBool(MI.dwFlags = MONITORINFOF_PRIMARY) Then '第一显示器
        MoveWindow Form1.hwnd, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, 1&
    Else
        MoveWindow Form2.hwnd, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, 1&
    End If
    MonitorEnumProc = 1
End Function
--------------------编程问答-------------------- 好东西,果断mark‘
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,