只有多文档开发环境有效!无法mx=x/screen.TwipsPerPixelX 
my=x/screen.TwipsPerPixelY

解决方案 »

  1.   

    Private Sub Form_Load()
    '设置 Form 的 StartUpPosition = 1
    '或
    Move (Screen.Width - Width) \ 2, (Screen.Height - Width) \ 2
    End Sub
      

  2.   

    Private Sub Form_Load() '在中间
    '设置 Form 的 StartUpPosition = 1
    '或
    Move (Screen.Width - Width) \ 2, (Screen.Height - Width) \ 2
    End Sub
    Private Sub Command1_Click() '发病率
    Print Screen.Height / Screen.TwipsPerPixelX, Screen.Width / Screen.TwipsPerPixelY
    End Sub
      

  3.   

    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    如果能用别忘了给分啊:)
      

  4.   

    有更绝的方法,而且支持MDI,支持各种分辩率。
    Public Function center(formcenter As Form)
    If (Form1.Height - formcenter.Height - Form1.Toolbar1.Height - Form1.StatusBar1.Height - Screen.Height * 7 / 90) < 0 Then
        str0 = Form1.Width - formcenter.Width
        str1 = 0
    Else
        If Form1.Width - formcenter.Width < 0 Then
            str0 = 0
            str1 = Form1.Height - formcenter.Height - Form1.Toolbar1.Height - Form1.StatusBar1.Height - Screen.Height * 7 / 90
        Else
            str0 = Form1.Width - formcenter.Width
            str1 = Form1.Height - formcenter.Height - Form1.Toolbar1.Height - Form1.StatusBar1.Height - Screen.Height * 7 / 90
        End If
    End If
    formcenter.Move str0 / 2, str1 / 2, formcenter.Width, formcenter.HeightEnd Function
    调用的时候用下列语句即可。
    a = center(Me)
    以上程序支持MDI,如果想让支持一般方式的话用上面他们的即可喽。
      

  5.   

    3.
    screen.Width/screen.TwipsPerPixelX
    screen.Height/screen.TwipsPerPixelY
      

  6.   

    VB里面不是可以设置form的位置吗?就是右下的那个“电脑屏幕”
      

  7.   

    以下方式绝对可以居中窗口:
    Form1.Top = Screen.Height / 2 - Form1.Height / 2
    Form1.Left = Screen.Width / 2 - Form1.Width / 2
    以下是得到像素(屏幕分辨率)最易的方法:
    Screen.Height / 15 '纵
    screen.width /15 '横