Get Clicked Shape !

T

Tamir Khason

Following the function to fetch shape clicked.

This works fine on shapes like Computer/Box etc. however this does not work
on Connectors. It return zero size selection while clicking on connector,
inspite the connector is shape as well. Why and how to catch click on
connector???



TNX

public static Visio.Shape GetClickedShape( Visio.Page visioPage, double x,
double y,double tolerance )

{



try

{

Visio.Selection visSelection = visioPage.get_SpatialSearch(x,y,

(short) Visio.VisSpatialRelationCodes.visSpatialContainedIn,

tolerance,

(short) Visio.VisSpatialRelationFlags.visSpatialFrontToBack);

Console.WriteLine("Selection is {0} size", visSelection.Count);

if (visSelection.Count > 0 )

{

Console.WriteLine( visSelection[1].Name);

return (Visio.Shape) visSelection[1];



}

else

{

return null;

}

}

catch( Exception exp)

{

Console.WriteLine( exp.Message );

throw exp;

}

}
 

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