首先:如何获得当前计算机屏幕的分辨率?方法一:Private Const SPI_GETWORKAREA = 48Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As LongPublic Type RECT Left As Long '矩形左上角的 X 坐标 Top As Long '矩形左上角的 Y 坐标 Right As Long '矩形右下角的 X 坐标 Bottom As Long '矩形右下角的 Y 坐标End Type Private Sub Command0_Click() Dim lRet As Long Dim apiRECT As RECT lRet = SystemParametersInfo(SPI_GETWORKAREA, vbNull, apiRECT, 0) MsgBox apiRECT.Right & "X" & apiRECT.BottomEnd Sub注意,上述得到的是可视屏幕的分辨率,假如任务栏可见,那么任务栏的高度排除在外。 2.根据取得的分辨率再循环所有的控件依次改变控件属性。方法二:'*****************************************************************' DECLARATIONS SECTION'*****************************************************************Option ExplicitType RECT x1 As Long y1 As Long x2 As Long y2 As LongEnd Type' NOTE: The following declare statements are case sensitive.Declare Function GetDesktopWindow Lib "User32" () As LongDeclare Function GetWindowRect Lib "User32" _ (ByVal hWnd As Long, rectangle As RECT) As Long'*****************************************************************' FUNCTION: GetScreenResolution()'' PURPOSE:' To determine the current screen size or resolution.'' RETURN:' The current screen resolution. Typically one of the following:' 640 x 480' 800 x 600' 1024 x 768''*****************************************************************Function GetScreenResolution () as String Dim R As RECT Dim hWnd As Long Dim RetVal As Long hWnd = GetDesktopWindow() RetVal = GetWindowRect(hWnd, R) GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)End Function然后:自动适应电脑显示器各种分辨率 2 例例一、1. Declare ...