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

Event.Persistable 属性 (Visio)Event.Persistable Property (Visio)

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

确定事件能否在其文档中具有永久性。只读。Determines whether an event can potentially persist within its document. Read-only.

语法Syntax

表达式持久expression . Persistable

表达式_一个表示事件对象的变量。_expression A variable that represents a Event object.

返回值Return Value

IntegerInteger

注解Remarks

事件对象的Persistable属性指示是否该事件可以保持不变,即是否可以与 Microsoft Visio 文档的程序的执行之间存储的事件对象。如果以下情况属实,事件对象可以具有永久性:The Persistable property of an Event object indicates whether the event can persist, that is, whether the Event object can be stored with a Microsoft Visio document between executions of a program. An Event object can persist if the following conditions are true:

  1. 事件对象的操作代码必须是visActCodeRunAddon 。如果操作代码为visActCodeAdvise ,该事件将不会保持不变,必须通过重新创建一个程序在运行时。The action code of the Event object must be visActCodeRunAddon . If the action code is visActCodeAdvise , the event won't persist and must be re-created by a program at run time.

  2. 源对象必须能够包含永久事件在其事件列表集合中。源对象的PersistsEvents属性指示是否可以包含持久事件。只有当前能够包含永久事件的源对象是文档文档和页面的对象。The source object must be capable of containing persistent events in its EventList collection. The source object's PersistsEvents property indicates whether it can contain persistent events. The only source objects currently capable of containing persistent events are Document , Master , and Page objects.

如果满足下列条件,下列任何事件都具有永久性:If these conditions are met, any of the following events are persistable:

  • BeforeMasterDeleteBeforeMasterDelete

  • BeforePageDeleteBeforePageDelete

  • BeforeShapeDeleteBeforeShapeDelete

  • DocumentOpenedDocumentOpened

  • DocumentCreatedDocumentCreated

  • MasterAddedMasterAdded

  • PageAddedPageAdded

尽管事件对象的Persistable属性指示事件是否可以保持不变,其持久属性指示是否该事件实际上仍然存在。当首次创建一个事件对象时,其持久属性设置为其Persistable属性的值相同。即一个持久事件持续属性设置为True ,则和一个 nonpersistable 事件持续属性设置为FalseAlthough an Event object's Persistable property indicates whether an event can persist, its Persistent property indicates whether that event actually persists. When an Event object is first created, its Persistent property is set to the same value as its Persistable property. That is, a persistable event's Persistent property is set to True , and a nonpersistable event's Persistent property is set to False .

非持久性事件存在,只要引用保存在事件对象、事件对象,它包含事件对象或有事件列表对象的源对象。发布到任何这些对象的最后一个引用时,非持久性事件将不再存在。A nonpersistent event exists as long as a reference is held on the Event object, the EventList object that contains the Event object, or the source object that has the EventList object. When the last reference to any of these objects is released, the nonpersistent event ceases to exist.

持续属性设置为False ,可以更改持久事件的初始设置。在这种情况下,事件不会保持其文档,即使它可能。但是,您不能更改持久属性的非持久性事件;尝试这样做将导致引发异常。You can change the initial setting for a persistable event by setting its Persistent property to False . In this case, the event doesn't persist with its document, even though it could. However, you cannot change the Persistent property of a nonpersistent event; attempting to do so will cause an exception.

请注意 事件处理中 (VBA) 项目 Microsoft Visual Basic for Applications 是永久性的。Note Events handled in a Microsoft Visual Basic for Applications (VBA) project are persistent.

© 2018 Microsoft