使窗体居中显示代码 下列代码适用于ACCESSXP以上 '使用方法: 'Private Sub Form_Load()
Option Compare Database Type RECT Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long '菜单栏高:22 Public Function moveFormToCenter(ByRef Frm As Form, Optional ByVal longFormWidth As Long = 0, Optional ByVal longFormHeight As Long = 0) Dim lngW, lngH As Long lngW = GetAccessClientWidth() - 4 '-4为测试微调值 lngH = GetAccessClientHeight() - 4 '-4为测试微调值 If longFormWidth + longFormHeight = 0 Then If longFormWidth > 0 And longFormHeight > 0 Then End Function Public Function GetAccessClientWidth() As Integer hwnd = Application.hWndAccessApp RetVal = GetClientRect(hwnd, R) End Function hwnd = Application.hWndAccessApp RetVal = GetClientRect(hwnd, R) End Function |
|站长邮箱|小黑屋|手机版|Office中国/Access中国
( 粤ICP备10043721号-1 )
GMT+8, 2025-4-3 13:42 , Processed in 0.073968 second(s), 17 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.