Private Type RECT
Left As Long 'X坐标,0
Top As Long 'Y坐标,0
Right As Long '相当于ScaleHeight
Bottom As Long '相当于ScaleWidth
End Type
Private Declare Function GetClientRect Lib "user32 " (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Sub Form_Load()
Form1.Width = 8000
Form1.Height = 8000
Picture1.Width = 7250
Picture1.Height = 7750
Dim MyRect As RECT
wndCapH = 0 '标题栏高
wndEdgeX = 0 '边框厚度
wndEdgeY = 0 '边框高度
GetClientRect Me.hwnd, MyRect
wndCapH = GetSystemMetrics(4)
Picture1.Left = (Form1.Width - MyRect.Right * 15) / 2
Picture1.Top = (Form1.Height - wndCapH * 15 - MyRect.Bottom * 15) / 2
End Sub
普及小知识(摘抄于网络&