Selected Shape in Visio ActiveX Drawing control - C#

Selected Shape in Visio ActiveX Drawing control - C#

Post by UHJhZGVlc » Thu, 29 Mar 2007 14:28:01


I am working on Visio ActiveX Drawing control.
I request some one to help me out with the code in C# to get the shape which
is slected in the visio diagram.
I have to access the properties of the shape that is selected in the
diagram. Please help me out...Language is C#.
 
 
 

Selected Shape in Visio ActiveX Drawing control - C#

Post by Chris Roth » Thu, 29 Mar 2007 15:36:04

Hi Pradeep,

Try something like this:

using Visio = Microsoft.Office.Interop.Visio;

...

Visio.Selection sel = visctrl.Window.Selection;

Visio.Shape visShpSelected;
if(sel.Count > 0)
{
visShpSelected = sel.Selection[1]
}

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.yqcomputer.com/
Visio programming info:
http://www.yqcomputer.com/
Other Visio resources:
http://www.yqcomputer.com/

 
 
 

Selected Shape in Visio ActiveX Drawing control - C#

Post by UHJhZGVlc » Thu, 29 Mar 2007 20:34:02

Hi Chris,

Thanks for the reply.
I am unable to import or Use the reference
"using Visio = Microsoft.Office.Interop.Visio"
even though I have added a reference of "Microsoft Visio 11.0 Type Library"
to my project.
Please let me know the pre-requisites for this.

Thanks,
Pradeep