Visio Guy

Visio Discussions => Visio 2010 Issues => Topic started by: RodrigoCampos on March 20, 2012, 11:15:06 AM

Title: Visio C# and EventSink
Post by: RodrigoCampos on March 20, 2012, 11:15:06 AM
I implemented an Windows form with eventsink to detect "shapeDeleted" once I just could access to

        axDrawingControl1.Window.Shape.BeforeShapeDelete

but I wanna to access to the "afterShapeDeleted", but right now I have two problems:

1- The below code do not work

         pageEventList.AddAdvise((short)Microsoft.Office.Interop.Visio.VisEventCodes.visEvtCodeShapeDelete, eventHandler, "", "");

I'm getting this error:

         {"\n\nAn exception occurred."}

I already tried this(with no success):

         pageEventList.AddAdvise((short)801, eventHandler, "", "");

2- The following code is working, but I don't know how can I return back to my form code to perform some extra code, once the detection is made at "EventSink.cs" class and not on my "Form.cs":

pageEventList.AddAdvise((short)Microsoft.Office.Interop.Visio.VisEventCodes.visEvtShape         + (short)Microsoft.Office.Interop.Visio.VisEventCodes.visEvtDel, eventHandler, "", "");

There is anyway to catch the interruption on my Form.cs?

Thank you in advance,
Rodrigo Campos