Visio Drawing Control - Setting Page Size

T

Tosh

I'm working with the Visio Drawing Control (Visio 2007, Dev Studio 2008, C#)
to create graphic overlays to print on top of different sized paper stock. I
have JPG images of the different stock sizes, and what's preprinted on the
stock. The user can then put their customization whereever they like over
that. There's another program that takes the output from Visio and does the
printing. This is my foray into working with Visio.

Here's what I'm trying to do.
1) Have the user select the paper stock: say they choose 3x5 invoice - load
the image, and resize the page to fit. I can do that in Visio, but haven't
found the corresponding command for the Visio Drawing Control to resize the
page to fit the image.

2) Make it so the user can't change image of the paper stock. This needs to
be displayed, but unchangeable. Everything the user does goes on top of
this, like putting a 1 inch square 1 inch from the top and 2 inches from the
left (we'll get back to this in #3). I've been looking at layers and
backgrounds, but haven't figured out which is the best way to go. Especially
with #3...

3) I need to save the users work as a .VSD and .WMF. That I've got figured
out. But I don't want to save the 3x5 image of the paper stock that I loaded
up. So I need to remove it, or make it invisible, or make it non-printing...
I'm not sure what. The kicker is that the saved .VSD / .WMF needs to include
the entire 3x5 area, and without the paper stock image, and the rectangle
added in #2 needs to be at 1 inch from the top and 2 inches from the left.
Without my paper stock image it tends to get save as a 1x1 graphic instead of
a 3x5 graphic with a square positioned at 1, 2.

My best idea so far is to take the paper stock image, load it, resize the
drawing surface (still trying to figure this out - this is #1, above), and
when it is time to save the work, remove the image from the drawing, and
place a tiny transparent rectangle in the top left corner and another in the
bottom right corner, to preserve the size of the drawing without adding any
real content.

Any suggestions are most welcome.
 
T

Tosh

Figured out 1) Resize to fit Image, using the drawing control

Microsoft.Office.Interop.Visio.Page page = drawingControl.Window.Page as
Microsoft.Office.Interop.Visio.Page;
page.ResizeToFitContents();
 
T

Tosh

Figured out #2 and #3. Layers.

#2) I added a layer for the immutable paper stock image, and locked it.

#3) The layer for the immutable paper stock is set as Print=False. That
retains the paper stock image in the .VSD, but doesn't include it when I
export it to a .WMF. The .WMF only extended to my other shapes, and didn't
retain the size of my paper stock layer. The solution for that was to put a
tiny line from 0, 0 to .001, .001, and in the opposite corner as well. That
set the boundaries for the drawing. To keep these lines from appearing in
the .WMF, I set the transparency to 99%. For all practical purposes, that's
invisible. Using a transparency of 100% or length of zero excludes it from
rendering in the .WMF, and then the boundaries collapse back to the visible
shapes.

I can post the code for doing this in C# with the Visio Drawing Control.
 

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