适用于
| BoundObjectFrame 对象 | Image 对象 | OptionButton 对象 | SubForm 对象 | 
| CheckBox 对象 | Label 对象 | OptionGroup 对象 | TabControl 集合 | 
| ComboBox 对象 | Line 对象 | Page 对象 | TextBox 对象 | 
| CommandButton 对象 | ListBox 对象 | PageBreak 对象 | ToggleButton 对象 | 
| CustomControl 对象 | ObjectFrame 对象 | Rectangle 对象 | 
可以在 Visual Basic for Applications (VBA) 代码中使用 IsVisible 属性来确定控件是否在报表上可见。 布尔型,可读/写。
表达式.IsVisible
表达式 必需。 返回“适用范围”列表中的对象之一的表达式。
备注
IsVisible 属性使用以下设置。
| 设置 | 说明 | 
| 正确 | (默认)控件可见。 | 
| False | 控件不可见。 | 
注意: 仅能在包含控件的报表节的 Print 事件中设置 IsVisible 属性。
可以将 IsVisible 属性与 HideDuplicates 属性结合使用来确定报表上的控件何时可见以及显示或隐藏其他控件作为结果。 例如,当文本框控件被隐藏时可以隐藏行控件,因为它包含重复值。
示例
以下示例使用文本框的 IsVisible 属性来控制报表上行控件的显示。 报表基于“产品”表,并使用具有以下属性的三个控件。
| 属性 | 行控件 | 文本框 1 | 文本框 2 | 
| Name | Line0 | CategoryID | ProductName | 
| ControlSource | CategoryID | ProductName | |
| HideDuplicates | 支持 | 不支持 | |
| Left | 0 | 0 | 2.0 | 
| Top | 0 | 0.1 | 0.1 | 
| Width | 4.0 | 1.0 | 1.0 | 
将以下代码粘贴到报表模块的“声明”部分,然后查看此报表以检查由 IsVisible 属性控制的行格式设置:
Private Sub Detail_Print(Cancel As Integer, _    PrintCount As Integer)    If Me!CategoryID.IsVisible Then        Me!Line0.Visible = True    Else        Me!Line0.Visible = False    End IfEnd Sub
