BeforeShapeDelete 事件 (Visio)Masters.BeforeShapeDelete event (Visio)

會在刪除圖形之前發生。Occurs before a shape is deleted.

語法Syntax

運算式BeforeShapeDelete(圖形)expression.BeforeShapeDelete (Shape)

_運算式_代表**主控形狀** 物件的變數。expression A variable that represents a Masters object.

參數Parameters

名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
ShapeShape 必要Required [IVSHAPE][IVSHAPE] 將要刪除的圖形。The shape that is going to be deleted.

註解Remarks

如果圖形的Type屬性是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事件類似于刪除圖形之前的兩個事件。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. BeforeShapeDelete事件會引發三次, 並作用於這三個物件。The BeforeShapeDelete event fires three times and acts on each of the three objects. BeforeSelectionDelete事件會引發一次, 而且它會作用於選取物件, 在其中會選取三個要刪除的圖形。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.

如果您想要建立自己的事件物件, 請使用**Add** 或**AddAdvise** 方法。If you want to create your own Event objects, use the Add or AddAdvise method. 若要建立可以執行附加元件的 Event 物件,可使用 Add 方法,因為它可適用於 EventList 集合。To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. 若要建立用於接收通知的 Event 物件,則使用 AddAdvise 方法。To create an Event object that receives notification, use the AddAdvise method. 若要尋找您要建立之事件的事件程式碼, 請參閱事件代碼To find an event code for the event that you want to create, see Event codes.

注意

您可以使用 VBA WithEvents關鍵字來接收BeforeShapeDelete事件。You can use the VBA WithEvents keyword to sink the BeforeShapeDelete event.

基於效能考量,Document 物件的事件集並不包含 BeforeShapeDelete 事件。For performance considerations, the Document object's event set does not include the BeforeShapeDelete event. 若要從Document物件 (和 VBA 專案中的**ThisDocument** 物件) 接收BeforeShapeDelete事件, 您必須使用AddAdvise方法。To sink the BeforeShapeDelete event from a Document object (and from the ThisDocument object in a VBA project), you must use the AddAdvise method.

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.