Form.InsideWidth 属性 (Access)

使用 InsideWidth 属性 (以及 InsideHeight 属性) 来确定包含窗体的 窗口) ( 高度和宽度。 读/写 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。