Document.QueryCancelConvertToGroup 事件 (Visio)Document.QueryCancelConvertToGroup event (Visio)

會在應用程式為回應介面上的使用者動作而將圖形選取範圍轉換成群組之前發生。Occurs before the application converts a selection of shapes to a group in response to a user action in the interface. 如果有任何事件處理常式傳回True,作業已取消此事件。If any event handler returns True, the operation is canceled.


運算式QueryCancelConvertToGroup(選取項目)expression.QueryCancelConvertToGroup (Selection)

_運算式_代表**Document** 物件的變數。expression A variable that represents a Document object.


名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
SelectionSelection 必要Required [IVSELECTION][IVSELECTION] 將要轉換成群組的圖形選取範圍。The selection of shapes that is going to be converted to a group.


Microsoft Visio 實例會在使用者指示它將一個或多個圖形轉換為群組後,引發 QueryCancelConvertToGroupA Microsoft Visio instance fires QueryCancelConvertToGroup after the user has directed the instance to convert one or more shapes into groups.

  • 如果有任何事件處理常式傳回 True (取消),該實例就會引發 ConvertToGroupCanceled,而且不會轉換圖形。If any event handler returns True (cancel), the instance fires ConvertToGroupCanceled and does not convert the shapes.

  • 如果所有的處理常式都傳回 False (不要取消),就會執行轉換作業。If all handlers return False (don't cancel), the conversion is performed.

某些情況下,例如當 ForeignType 屬性為 visTypeMetafile 的圖形轉換為群組時,初始的圖形會遭到刪除,並以新的圖形取代。In some cases, such as when a shape that has a ForeignType property of visTypeMetafile is converted to a group, the initial shape is deleted and replaced with new shapes. 在這一類情況下,Visio 實例會依序引發 BeforeSelectionDeleteBeforeShapeDelete 事件,然後才轉換圖形。In such cases, the Visio instance subsequently fires BeforeSelectionDelete and BeforeShapeDelete events before converting the shapes.

當 Visio 實例引發查詢或取消事件時,它會回應來自用戶端程式碼的查詢,但是會拒絕執行作業。While a Visio instance is firing a query or cancel event, it responds to inquiries from client code but refuses to perform operations. 用戶端程式碼可以在回應查詢或取消事件時,顯示表單或訊息方塊。Client code can show forms or message boxes while responding to a query or cancel event.

如果您是使用 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 方法。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.

支援和意見反應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.