使用 InsideHeight 屬性 (以及 InsideWidth 屬性) ,以判斷包含表單之視窗的 twips) 的高度和寬度 (。 讀取/寫入的 Long。
語法
表達。內部高度
expression 代表 Form 物件的變數。
註解
如果您想要判斷表單本身的內部尺寸,您可以使用 Width 屬性來決定表單寬度,以及表單可見區段高度的總和來決定其高度, (Height 屬性僅適用於表單區段,不適用於表單) 。 在表單的內部是區域內的表單、 捲軸及記錄選取器除外。
您也可以使用 WindowHeight 和 WindowWidth 屬性來決定包含表單之視窗的寬度與高度。
如果視窗已經放到最大,直到視窗還原為正常的大小,設定這些屬性才會有影響。
範例
下列範例會示範如何使用的 InsideHeight 和 InsideWidth 屬性要比較內部高度和寬度與高度表單及表單之視窗的寬度。 如果視窗的尺寸不等於表單的大小,則會調整視窗大小以符合表單的高度和寬度。
Sub ResetWindowSize(frm As Form)
Dim intWindowHeight As Integer
Dim intWindowWidth As Integer
Dim intTotalFormHeight As Integer
Dim intTotalFormWidth As Integer
Dim intHeightHeader As Integer
Dim intHeightDetail As Integer
Dim intHeightFooter As Integer
' Determine form's height.
intHeightHeader = frm.Section(acHeader).Height
intHeightDetail = frm.Section(acDetail).Height
intHeightFooter = frm.Section(acFooter).Height
intTotalFormHeight = intHeightHeader _
+ intHeightDetail + intHeightFooter
' Determine form's width.
intTotalFormWidth = frm.Width
' Determine window's height and width.
intWindowHeight = frm.InsideHeight
intWindowWidth = frm.InsideWidth
If intWindowWidth <> intTotalFormWidth Then
frm.InsideWidth = intTotalFormWidth
End If
If intWindowHeight <> intTotalFormHeight Then
frm.InsideHeight = intTotalFormHeight
End If
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。