Grouping Shapes

N

news.micrsoft.com

I'm using C# to make an app that interfaces with visio. Right now I can crea
te a cloud shape and place it on my c# form. I want to be able to add other
objects inside of the cloud shape. Any ideas how to best add the shapes
inside the cloud and perhaps group them if that is possible.

Also right now it places one cloud in the center of the c# screen, but I mig
ht very well have 2,3,4, or even more clouds. I know how to resize and move
shapes, but I'm trying to think of some kind of algorithm or forumlaU that I
can use to adjust the placement of the shapes based on how many shapes i wa
nt to create. ideal some way to do this other then just a huge long if 1, if
2, if 3 , if 4 statement.

Thanks
bourdett
 
M

Mark Nelson [MS]

Drop your cloud shape and drop your other shapes. Then create a selection
object that includes the cloud shape as the first item in the selection and
the other shapes as subsequent items. Run the AddToGroup method on the
selection. (If your cloud shape was not already a group, you'll need to
individually put it in a selection and run the ConvertToGroup method, but I
suggest you design your cloud so that it starts as a group.)

You may want to use Visio's LayOutShapes method to arrange multiple clouds
on your page. The best way to code this is to turn on Macro Recorder and
use the LayOutShapes command in the UI. This will give you the settings
that you should set via automation.
 

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