有一个多文挡窗口,一个登陆窗口。登陆窗口设置为多文挡窗口的子窗口,每次运行的时候登陆窗口都躲在多文挡窗口的左上角,我想登陆的时候能够显示在多文挡窗口的中间,设置登陆窗口的什么属性???startupposition属性好象不行。

解决方案 »

  1.   

    '*********************************************************
    '* 名称:FormSet(formname,mode)
    '* 功能:此函数用于初始化窗体的大小和位置
    '* 用法:mode 满屏(0),左上(1),右上(2),左下(3),右下(4),居中(5)
    '*********************************************************
    Public Function FormSet(F As Form, Nu As Integer) As String
        Dim BarHeight As Integer  '任务条的高度
        BarHeight = 27 * 15
        If IsNull(Nu) Then
            Nu = 0
        End If
        F.ScaleMode = 3 '将窗体的分辨率设为象素级
        Select Case Nu  '根据参数设置窗体的大小和位置
            Case 0          '默认的窗体效果,最大化
                With F
                    .Top = 0
                    .Left = 0
                    .Width = Screen.Width
                    .Height = Screen.Height - BarHeight
                End With
            Case 1          '窗体的位置居左上
                With F
                    .Top = 0
                    .Left = 0
                End With
            Case 2          '窗体的位置居右上
                With F
                    .Top = 0
                    .Left = Screen.Width - .Width
                End With
            Case 3          '窗体的位置居左下
                With F
                    .Top = Screen.Height - .Height - BarHeight
                    .Left = 0
                End With
            Case 4          '窗体的位置居右下
                With F
                    .Top = Screen.Height - .Height - BarHeight
                    .Left = Screen.Width - .Width
                End With
            Case 5          '窗体的位置居中
                With F
                    .Top = (Screen.Height - .Height) / 2
                    .Left = (Screen.Width - .Width) / 2
                End With
        End Select
        F.Icon = F_Main.Icon
    End Function