Auto Sizing (changing zoom) to fit whole drawing in window

R

Ryo_Ohki2

First, when I load the drawing using:
VisioDrawingCtrl.SRC = "MyVisioDrawing.VSD"
it would resize the drawing page to be smaller than the whole drawing
causing shapes to be off the page. If I open it in visio, it's fine..
If I can stop it from resize the drawing page size..

Is there a way to automatically resize or change my zoom to fit m
drawing whether it's on or off the drawing page? (When I say Off th
page, I mean shapes are in the gray area of the drawing).

Note I know about the Window.Zoom command and the Window.ViewFit

Examples of course would be helpful. Thanks
 
R

Ryo_Ohki2

Unfortunately that didn't work since it resizes window to show all o
the page but the drawing is partially off the page. I found out wh
everything was off my page since I set my drawing to resiz
automatically to the window size so it wouldn't automatically set m
coworker's drawing in my window properly. For now that will work.
was thinking I might have to get the cordinates of all the parts an
calculate the size of the window needed.. but that's a lot o
programming to do which I probably don't have time for at the moment
 
J

JuneTheSecond

Another idea might be to use SetViewRect method and group method, for example:

Sub FitWindowToShapes()
Dim myShape As Visio.Shape
Dim dLeft As Double, dTop As Double, dWidth As Double, dHeight As Double
ActiveWindow.SelectAll
Set myShape = ActiveWindow.Selection.Group
dWidth = myShape.Cells("Width").ResultIU
dHeight = myShape.Cells("Height").ResultIU
dLeft = myShape.Cells("PinX").ResultIU - dWidth * 0.5
dTop = myShape.Cells("PinY").ResultIU + dHeight * 0.5
ActiveWindow.SetViewRect dLeft, dTop, dWidth, dHeight
myShape.Ungroup
End Sub
 
R

Ryo_Ohki2

That's a interesting idea. That looks like that would work. Thanks fo
the suggestion :
 

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