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

Shape.BeforeShapeDelete 事件 (Visio)Shape.BeforeShapeDelete Event (Visio)

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

在删除形状之前,发生此事件。Occurs before a shape is deleted.

语法Syntax

专用子_表达式__BeforeShapeDeleteByVal 形状为 [IVSHAPE]Private Sub expressionBeforeShapeDelete( **_ByVal Shape As [IVSHAPE]** )

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

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
形状Shape必需Required[IVSHAPE][IVSHAPE]要删除的形状。The shape that is going to be deleted.

注解Remarks

如果该形状的类型属性为visTypeGroup (2) 或visTypePage (1),一个Shape对象可以作为BeforeShapeDelete事件的源对象。A Shape object can serve as the source object for the BeforeShapeDelete event if the shape's Type property is visTypeGroup (2) or visTypePage (1).

因为它们都激发的形状被删除之前, BeforeSelectionDeleteBeforeShapeDelete事件很相似。它们在一次操作中删除多个形状时它们的行为方式上存在差异。假设一个剪切操作删除三种形状。BeforeShapeDelete事件触发三次,每三个对象的作用。BeforeSelectionDelete事件将触发一次,和它在其中选择要删除的三个形状的选定对象上所起的作用。The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. They differ in how they behave when a single operation deletes several shapes. Suppose a Cut operation deletes three shapes. The BeforeShapeDelete event fires three times and acts on each of the three objects. The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

如果您使用 Microsoft Visual Basic 或 Visual Basic for Applications (VBA),则此主题中的语法描述的是一种通用而有效的事件处理方法。If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

如果您想要创建您自己的事件对象,使用添加AddAdvise方法。若要创建一个事件对象,运行加载项,请使用Add方法,应用到事件列表集合。若要创建一个事件对象,该对象接收通知,请使用AddAdvise方法。若要查找您想要创建的事件的事件代码,请参阅事件代码If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, seeEvent codes.

请注意 VBA WithEvents关键字可用于接收BeforeShapeDelete事件。Note You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

出于性能考虑,文档对象的事件集不包括BeforeShapeDelete事件。若要从文档对象 (和 VBA 项目中的状态报告对象),则接收BeforeShapeDelete事件,必须使用AddAdvise方法。For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.

如果 Visual Studio 解决方案中包含的Microsoft.Office.Interop.Visio引用,此事件将映射到以下类型:If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this event maps to the following types:

  • Microsoft.Office.Interop.Visio.EShape_BeforeShapeDeleteEventHandlerBeforeShapeDelete委托。)Microsoft.Office.Interop.Visio.EShape_BeforeShapeDeleteEventHandler (the BeforeShapeDelete delegate.)

  • Microsoft.Office.Interop.Visio.EShape_Event.BeforeShapeDeleteBeforeShapeDelete事件。)Microsoft.Office.Interop.Visio.EShape_Event.BeforeShapeDelete (the BeforeShapeDelete event.)

© 2018 Microsoft