Resize shape

A

Anthony

Hi

I would like to resize a shape after I drop a master on a page. Please let
me know how I can do it programmatically

Thanks

Anthony
 
J

JuneTheSecond

One idea mighit be to put macro in the module, ThisDocument, like a ,,,
Private Sub Document_ShapeAdded(ByVal Shape As IVShape)
Shape.Cells("width").Result("mm") = Shape.Cells("width").Result("mm") * 2#
End Sub
This macro resizes all shapes that is dropped on the drawing.
If you would like that just a speciphic shape is resized, you might put a
function that trigers the macro , for example "CallThis" or a function
directly resize the shape in the EventDrop cell at Event section in the
shapesheet of the shape.
 
A

Anthony

Hi JuneThe Second

Thanks for your reply. I'm writing C# and using the Visio OCX. When I try
the following

Visio.Shape parentShape = visPage.Drop( objectLifelineMaster, topLevelX,
topLevelY);
Visio.Cell cell = parentShape.get_CellsU("Height");
cell.ResultIU = cell.ResultIU * 5.0;

I got the exception saying that Cell is guarded. Any idea?

Thanks in advance

Anthony
 
J

JuneTheSecond

You might make use of ResultUForce property. but.....
You would be adviced that you would look at the cell and check if there is a
protected formula. If a formula, then you might change the formula with
FormulaForce or FormulauForce property.
 
A

Anthony

Hi June

I found that there is the ResultIUForce to force the change. I wrote the
following code
Visio.Cell cell = parentShape.get_CellsU("Height");
cell.ResultIUForce = cell.ResultIU * 5.0;

No more exception and part of the shape has changed size. The master is the
"Object Lifeline" shape of the UML Sequence stencil. It has the rectangle
box at the top and a vertical line below the box. When I did the code
shown, the size of the box changed. I want to extend the vertical line
instead. I could do it on the UI. I would like to do it programmatically.

Thanks in Advance

Anthony
 

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