Set Background Image.

Started by yoursashok, March 09, 2009, 09:33:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yoursashok

Hi,

I would like to know if there is a way to set the back ground image in Visio using C#. The shapes and other connectors in the page should be on top of the image..

Any help on this would be greatly appreciated.

Thanks,
Ashok.

Paul Herber

Best to use a background page
Add a page to the document, set it to be a background page, then add your image and resize it to the same as the page.


Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

yoursashok

Thanks Paul..

I tried creating a page with the image and resized to fit the size of the image... but I was facing problem in assigning this page as a back to an existing page using Page.BackPage method.. is there a different way to set the back ground page..

Also, when I manually set the background to a page of the image size, the new page is not taking the size of the background page ? is there a way to set that ?

The other option that I tried is to make use of the Layers .. I created a layer with the background image.. and I dropped my other shapes to a new layers.. The shapes are connected hence there is a third layer connector in the document. I have sent the connector back to the shapes to see the  shapes in front. What I see with the layers is like the connectors are sent back as the lowest layer.. Is there a way where I can specify the layer order.. which should be seen first, second etc.,

Thanks,
Ashok.

Paul Herber

Quote from: yoursashok on March 09, 2009, 04:02:55 PM
Thanks Paul..

I tried creating a page with the image and resized to fit the size of the image... but I was facing problem in assigning this page as a back to an existing page using Page.BackPage method

Hold it right there! Wrong method. Do you have any documentation for what these methods etc do? You can't just guess at their function! You need the Page.Background property.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

yoursashok

Thanks that did worked.. I tried the background earlier.. but have made a mistake..

I have a related question.. after creating the background page, the focus goes to the new page created.. but I want to move it to an existing page after setting the background page to the existing page.. is there a way to do it automatically in c#..

Regards,
Ashok.

Paul Herber

Save the name of the page to which you want to return, say in variable savedPageName, do your new page, then
ActiveWindow.Page = savedPageName;

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

yoursashok

Thanks Paul.. that worked..

Regards,
Ashok.