- ©«¤l
- 181
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 197
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2000
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2014-3-9
- ³Ì«áµn¿ý
- 2024-4-29
|
§Ú¤]²Ä¤@¦¸¥ÎZOOM
µo²{¥¦¦³¯Ê³´, ¼e°ª¥u¯à¦P©ñ¤j©ÎÁY¤p, ¤£¯à¤@Ãä©ñ¤j¥t¤@ÃäÁY¤p
¥u¦n¾E´N¥¦
// ================
Dim Form_First_wh
Dim Form_Last_wh
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function SetActiveWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const GWL_STYLE = (-16)
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const WS_THICKFRAME = &H40000
Const SM_CXFULLSCREEN = 16
Const SM_CYFULLSCREEN = 17
Const HWND_TOPMOST = -1
Const SWP_SHOWWINDOW = &H40
Dim hWndForm As Long
Dim IStyle As Long
Private Sub UserForm_Initialize()
hWndForm = FindWindow("ThunderDFrame", Me.Caption)
IStyle = GetWindowLong(hWndForm, GWL_STYLE)
IStyle = IStyle Or WS_THICKFRAME
IStyle = IStyle Or WS_MINIMIZEBOX
IStyle = IStyle Or WS_MAXIMIZEBOX
SetWindowLong hWndForm, GWL_STYLE, IStyle
Form_First_wh = Array(UserForm1.Width, UserForm1.Height)
Form_Last_wh = Form_First_wh
End Sub
Public Sub myShowMax()
SetActiveWindow hWndForm
ShowWindow hWndForm, SW_SHOWMAXIMIZED
End Sub
Private Sub UserForm_Resize()
If (Form_First_wh(1) - UserForm1.Height) * (Form_First_wh(0) - UserForm1.Width) < 0 Then
MsgBox "UserForm1.Zoom µLªk¤ä´©µøµ¡¤@Ãä©ñ¤j, ¥t¤@Ãä«oÁY¤p"
UserForm1.Move UserForm1.Left, UserForm1.Top, Form_Last_wh(0), Form_Last_wh(1)
Exit Sub
End If
On Error Resume Next
If Abs(Form_First_wh(1) - UserForm1.Height) > Abs(Form_First_wh(0) - UserForm1.Width) Then
UserForm1.Width = UserForm1.Height / Form_First_wh(1) * Form_First_wh(0)
Else
UserForm1.Height = UserForm1.Width / Form_First_wh(0) * Form_First_wh(1)
End If
On Error GoTo 0
Form_Last_wh = Array(UserForm1.Width, UserForm1.Height)
UserForm1.Zoom = UserForm1.Height / Form_First_wh(1) * 100
End Sub |
|