|
新建一个模块:获取窗口分辨率,把代码复制进去
'=========================================================================
Private Declare Function GetSystemMetrics Lib "User32" (ByVal nIndex As Long) As Long
Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Function ctload(x As Integer)
x = GetSystemMetrics(SM_CXSCREEN)
y = GetSystemMetrics(SM_CYSCREEN)
End Function
'===========================================================================
‘在需要自动适应分辨率的窗口加载事件中黏贴以下代码
Private Sub Form_Load()
Dim x As Integer
Call ctload(x) '获取当前窗口屏幕分辨率
If x = 800 Then '当你的程序在800*600分辨率下开发X=800,否则X=1024,其他分辨率类推
DoCmd.Maximize '采用ACCESS的窗口最大化命令,所有窗口、控件的比例最合适。比其他方案简单
Else
DoCmd.Restore '当前分辨率不等于你的程序开发时的分辨率时,恢复到原始大小的窗口
End If
End Sub |
|