Table of contents
TOC
折叠目录
展开目录

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

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

可以使用该属性可以指定是否重新绘制窗体。读/写boolean 类型的值You can use the Painting property to specify whether a form is repainted. Read/write Boolean.

语法Syntax

表达式绘制expression. Painting

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

注解Remarks

只有在“窗体”视图中才能设置和应用此属性,而在其他视图中此属性是不可用的。This property can be set and applies only in Form view and is unavailable in other views.

该属性等同于 Echo 操作。但是,它可以防止重画单个的窗体,而 Echo 操作则只能防止重画应用程序中所有打开的窗口。The Painting property is similar to the Echo action. However, the Painting property prevents repainting of a single form, whereas the Echo action prevents repainting of all open windows in an application.

该窗体的属性设置为False还会阻止所有的控件 (子窗体控件除外) 在窗体上被重画。若要防止窗体控件被重画,必须Painting属性的子窗体的属性设置为False。(请注意您将子窗体,不是子窗体控件的绘制属性设置)。Setting the Painting property for a form to False also prevents all controls (except subform controls) on a form from being repainted. To prevent a subform control from being repainted, you must set the Painting property for the subform to False. (Note that you set the Painting property for the subform, not the subform control.)

每当窗体获取或失去焦点时,该属性自动设置为True 。如果您不希望看到对窗体或其控件所做的更改在窗体上工作时,可以设置该属性为False 。例如,如果某个窗体有一组窗体调整大小时自动调整大小的控件,并且您不希望用户看到单个控件的移动,则可以关闭Painting ,然后移动所有控件,再打开Painting.The Painting property is automatically set to True whenever the form gets or loses the focus. You can set this property to False while you are working on a form if you don't want to see changes to the form or to its controls. For example, if a form has a set of controls that are automatically resized when the form is resized and you don't want the user to see each individual control move, you can turn Painting off, and then move all of the controls, then turn Painting back on.

示例Example

下面的示例使用属性来启用或禁用窗体涂色,具体取决于SetPainting变量设置为TrueFalse。如果关闭窗体绘制,则 Microsoft Access 将显示沙漏图标时绘制处于禁用状态。The following example uses the Painting property to enable or disable form painting depending on whether the SetPainting variable is set to True or False. If form painting is turned off, Microsoft Access displays the hourglass icon while painting is turned off.

Public Sub EnablePaint(ByRef frmName As Form, _ 
 ByVal SetPainting As Integer) 

 frmName.Painting = SetPainting 

 ' Form painting is turned off. 
 If SetPainting = False Then 
 DoCmd.Hourglass True 
 Else 
 DoCmd.Hourglass False 
 End If 

End Sub

另请参阅See also

概念Concepts

窗体对象Form Object

© 2018 Microsoft