共用方式為


Access (的 Form.InsideWidth 屬性)

使用 InsideWidth 屬性 (以及 InsideHeight 屬性) ,以 twip) 包含表單的視窗判斷高度和寬度 (。 讀取/寫入的 Long

語法

運算式InsideWidth

expression 代表 Form 物件的變數。

註解

如果您想要判斷表單本身的內部維度,您可以使用 Width 屬性來決定表單寬度,並使用表單可見區段的高度總和來判斷其高度 (Height 屬性僅適用于表單區段,而非表單) 。 在表單的內部是區域內的表單、 捲軸及記錄選取器除外。

您也可以使用 WindowHeightWindowWidth 屬性來決定包含表單之視窗的寬度與高度。

如果視窗已經放到最大,直到視窗還原為正常的大小,設定這些屬性才會有影響。

範例

下列範例會示範如何使用的 InsideHeightInsideWidth 屬性要比較內部高度和寬度與高度表單及表單之視窗的寬度。 如果視窗的維度不等於表單的大小,視窗會調整大小,以符合表單的高度和寬度。

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 支援與意見反應