Table of contents

Form.InsideWidth 属性 (访问)Form.InsideWidth Property (Access)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

可以使用InsideWidth属性和InsideHeight属性) 来确定包含窗体的窗口的高度和宽度 (以缇为单位)。读/写You can use the InsideWidth property (along with the InsideHeight property) to determine the height and width (in twips) of the window containing a form. Read/write Long.


表达式InsideWidthexpression. InsideWidth

表达式_一个表示窗体对象的变量。_expression A variable that represents a Form object.


如果要确定窗体本身的内部尺寸,可以使用 Width 属性来确定窗体的宽度,并使用窗体的可见部分的高度之和来确定窗体的高度( Height 属性只应用于窗体的各个部分,而不是窗体)。窗体的内部是指窗体内的区域,不包括滚动条和记录选择器。If you want to determine the interior dimensions of the form itself, you use the Width property to determine the form width and the sum of the heights of the form's visible sections to determine its height (the Height property applies only to form sections, not to forms). The interior of a form is the region inside the form, excluding the scroll bars and the record selectors.

也可以使用 WindowHeightWindowWidth 属性来确定包含窗体的窗口的高度和宽度。You can also use the WindowHeight and WindowWidth properties to determine the height and width of the window containing a form.

如果一个窗口处于最大化状态,那么对这些属性进行的设置只有在窗口恢复为正常大小时才起作用。If a window is maximized, setting these properties doesn't have any effect until the window is restored to its normal size.


下面的示例显示如何使用 InsideHeight 属性和 InsideWidth 属性对窗体的内部高度、内部宽度和包含窗体的窗口的高度、宽度进行比较。如果窗口与窗体大小不相等,则重新设置窗口的大小,使其与窗体的高度和宽度相一致。The following example shows how to use the InsideHeight and InsideWidth properties to compare the inside height and width of a form with the height and width of the form's window. If the window's dimensions don't equal the size of the form, then the window is resized to match the form's height and width.

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

另请参阅See also


窗体对象Form Object

© 2018 Microsoft