使窗體居中顯示代碼
access中的窗體雖然設(shè)置了自動(dòng)居中,但是打開(kāi)后總是有點(diǎn)不居中的感覺(jué),加下如下代碼可以做到真正居中顯示
Private Sub Form_Load()
DoCmd.Echo False
Dim x, y As Integer
DoCmd.Maximize
x = Me.WindowWidth
y = Me.WindowHeight
DoCmd.Restore
DoCmd.Echo True
Move (x - Me.WindowWidth) / 2, (y - Me.WindowHeight) / 2
End Sub
access中的窗體雖然設(shè)置了自動(dòng)居中,但是打開(kāi)后總是有點(diǎn)不居中的感覺(jué),加下如下代碼可以做到真正居中顯示
Private Sub Form_Load()
DoCmd.Echo False
Dim x, y As Integer
DoCmd.Maximize
x = Me.WindowWidth
y = Me.WindowHeight
DoCmd.Restore
DoCmd.Echo True
Move (x - Me.WindowWidth) / 2, (y - Me.WindowHeight) / 2
End Sub