ActiveX Control "New Document" ?

A

Anne Nonyme

Hi

I try to clear the contents of Visio ActiveX Control, same as doing a "New
Document". How to do that, "Document.Close" do no work with control.

Thanks
Anne
 
C

Chris Roth [ Visio MVP ]

Found this in my tech-stash:

Using Blank Documents in the Control

To load a blank drawing in the control when the control is initialized for
the first time, set the Src property to an empty string. However, if you
want to emulate creating a new blank drawing in the control after loading an
existing drawing document, you have three choices:

· Select all and delete all shapes in the drawings. This
approach allows the developer to preserve any existing styles in the
currently loaded document.

· Load a new, blank document using the Src property.

· Dynamically destroy and reinitialize the Visio drawing
control in the document.


--

Hope this helps,

Chris Roth
Visio MVP
 
A

Anne Nonyme

I do :

foreach ( Page l_Page in m_VisioCtrl.Document.Pages )
{
l_Page.Delete (0);
}

And it works. Thanks
Regards
Anne
 
M

Mark Nelson [MS]

One of the three methods mentioned by Chris is preferred. I do not
recommend deleting the last page in a document to make it blank. This can
cause unpredictable results.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Anne Nonyme said:
I do :

foreach ( Page l_Page in m_VisioCtrl.Document.Pages )
{
l_Page.Delete (0);
}

And it works. Thanks
Regards
Anne

"Chris Roth [ Visio MVP ]" <[email protected]> a écrit dans
le message de news:[email protected]...
Found this in my tech-stash:

Using Blank Documents in the Control

To load a blank drawing in the control when the control is initialized for
the first time, set the Src property to an empty string. However, if you
want to emulate creating a new blank drawing in the control after
loading
an
existing drawing document, you have three choices:

· Select all and delete all shapes in the drawings. This
approach allows the developer to preserve any existing styles in the
currently loaded document.

· Load a new, blank document using the Src property.

· Dynamically destroy and reinitialize the Visio drawing
control in the document.


--

Hope this helps,

Chris Roth
Visio MVP
 
M

Mai-lan [MS]

The preferred method is to load a blank document. This means using the SCR
property to load a blank document that you have explicitly created and put
on your file system.

Selecting and deleting shapes may leave layers and other legacy items in the
document. Dynamically destroying and intializing the control seems like
overkill.

Thanks,
Mai-lan
Microsoft Corp.

Mark Nelson said:
One of the three methods mentioned by Chris is preferred. I do not
recommend deleting the last page in a document to make it blank. This can
cause unpredictable results.

--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

Anne Nonyme said:
I do :

foreach ( Page l_Page in m_VisioCtrl.Document.Pages )
{
l_Page.Delete (0);
}

And it works. Thanks
Regards
Anne

"Chris Roth [ Visio MVP ]" <[email protected]> a écrit dans
le message de news:[email protected]...
Found this in my tech-stash:

Using Blank Documents in the Control

To load a blank drawing in the control when the control is initialized for
the first time, set the Src property to an empty string. However, if you
want to emulate creating a new blank drawing in the control after
loading
an
existing drawing document, you have three choices:

· Select all and delete all shapes in the
drawings.
This
approach allows the developer to preserve any existing styles in the
currently loaded document.

· Load a new, blank document using the Src property.

· Dynamically destroy and reinitialize the Visio drawing
control in the document.


--

Hope this helps,

Chris Roth
Visio MVP


Hi

I try to clear the contents of Visio ActiveX Control, same as doing
a
"New
Document". How to do that, "Document.Close" do no work with control.

Thanks
Anne
 

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