Visio Control : ConnectionsAdded/ConnectionDeleted

A

Anne Nonyme

Hello
The events ConnectionAdded & ConnectionDeleted are not available for Visio
Control ?!!?!

How is possible to do real-world applications without these events ?

Some workaround ?

Regards

Anne
 
A

Anne Nonyme

How to do:

1) Some constants
private const int k_EvtConnectionsAdded =
(int)(Vis.VisEventCodes.visEvtAdd)+(int)(Vis.VisEventCodes.visEvtConnect);

2) Register for event
m_MyVisioCtrl.Document.Application.EventList.AddAdvise
(unchecked((short)k_EvtConnectionsAdded), MyHandler, "",
"ConnectionsAdded");

3) A handler class
public class MyHandlerClass : Vis.IVisEventProc
{
public object VisEventProc(short nEventCode, object pSourceObj, int
nEventID, int nEventSeqNum, object pSubjectObj, object vMoreInfo)
{
switch ( nEventCode & 0xffff )
{
case k_EvtConnectionsAdded :
OnConnectionsAdded ((Vis.Connects)pSubjectObj);
break;
}
return null;
}
}

4) A handler
HandlerClass MyHandler = new MyHandlerClass();
 
M

Mike Z

The code should work if you mean to catch and handle the event when a
connection between shapes is made.

A minor (tricky) thing in your code that could make difference is the
integer type, int or short. You might want to stick to "short" all the time.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top