Share via

Visio with C#

Anonymous
2010-09-16T06:41:37+00:00

Hi all,

I really help regarding visio itegration with C#. I am using visio 2007 and visual studio 2008.

  1. I want to create a custom property of a visio shape and set a class object to that. Suppose I have class car. Now I want to create custom property of a visio shape and set car object to that property and also retreive the same. Can it be possible.
  2. Second problem is that if i drop a shape "Hard disk" from "Computer" stencil, then I need to get that name "Computer".

I am badly waiting for your reply.

Thanx in advance.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2010-10-06T13:34:33+00:00

    In my objeect classes I often have a (sub)group of properties that I instantiate into the visio shapes as custom properties. These of course are saved with the document. A second strategy (assuming you are at v2007 Pro or greater) is to import you working data as datarecordsets, and link them to the shapes. This has the obvious advantage of being able to open the ExternalData window in Visio to examine the entire associated record.

    There's a vb.net example of some of this over at http://visrackcompattr.codeplex.com/

    hth,

    al

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-10-06T13:17:12+00:00

    thanx for your reply. Can it be possible to inherit shape class or IVShape interface and write my own property that will save with the shape when i save the drawing?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-09-16T14:43:12+00:00

    one final point, check out the 'office plan sample' in the sdk.

    al

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-09-16T14:41:18+00:00

    The first step is to get a copy of the Visio sdk

    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=373d34b8-5ef7-4e6e-a582-c8d6b5ee4e33

    which has example code on creating and reading shapedata (custom properties). I usually put the visio custom code internal to the class that I am working with. i.e. for a 'class car' any custom visio manipulation is internal to the class and generic draw is somewhere else.

    The second part is that when a shape is dropped on a page, an event is fired which identifies the shape. The name of the master that was used to create the copy that was dropped on the page is an attribute of the shape (shape.master) and can be interrogated. This obviously gives you a starting point to call your class (it a car shape, a truck shape, etc.)

    hth,

    al

    Was this answer helpful?

    0 comments No comments