- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
21#
發表於 2015-5-20 13:56
| 只看該作者
本帖最後由 GBKEE 於 2015-5-20 14:00 編輯
回復 19# PKKO
直接放大- Option Explicit
- Dim Form_Tag As Variant
- Private Sub UserForm_Initialize() '表單初始化的程式
- Dim e As Control
- Form_Tag = Split(Top & "," & Left & "," & Width & "," & Height & "," & Font.Size, ",")
- Form_xlMax
- End Sub
- Private Sub Form_xlMax() '表單最大化
- Dim xZoom As Double, yZoom As Double, e As Control
- With Application
- .WindowState = xlMaximized
- xZoom = .Width / Form_Tag(2) '寬放大的比例
- yZoom = .Height / Form_Tag(3) '高放大的比例
- End With
- Top = 0
- Left = 0
- Width = Width * xZoom
- Height = Height * yZoom
- For Each e In Controls
- With e
- .Top = .Top * xZoom
- .Left = .Left * xZoom
- .Width = .Width * xZoom
- .Height = .Height * yZoom
- .Font.Size = .Font.Size * xZoom
- End With
- Next
- End Sub
複製代碼 |
|