The integration of custom menus in Visio Drawing control is a must for many projects, and many friends have asked me how to implement these menus, the following is the implementation of the Visio custom menu.
In Visio two development, there are two ways to add a custom menu for Visio Drawing Control: One is to use a Mouseupevent event that captures Visio, a pop-up ContextMenu can be used, and another is through the PageSheet Add action to implement, that is, use the RUNADDONWARGS function to implement.
The effect of both implementations is shown in the following illustration, and the difference is that using the second type preserves some of the Visio control's original menus, such as copied, pasted
First, first, register the Mouseupevent event, as shown in the following code:
drawingControl.MouseUpEvent += new AxMicrosoft.Office.Interop.VisOcx.EVisOcx_MouseUpEventHandler(this.onDrawingControlMouseUp);