How to Programatically...

V

Vivek

Hello All,

I will greatly appreciate if someone can tell me how to programatically make
visio drawing non-editable using visio ActiveX control in VB.net, while the
drawing is non-editable I still want to zoom-in or zoom-out in the drawing?

Thanks.
 
M

Mark Nelson [MS]

One possibility would be to put the contents of the drawing on a locked
layer or background page.
 
K

Kari Yli-Kuha

Vivek said:
Hello All,

I will greatly appreciate if someone can tell me how to programatically make
visio drawing non-editable using visio ActiveX control in VB.net, while the
drawing is non-editable I still want to zoom-in or zoom-out in the drawing?

Thanks.

This can be done e.g. by protecting document shapes
and setting existing shapes' selectionprotection.
You still can add new shapes, though...


Sub ProtectPage()

Dim ovShape As Visio.Shape

For Each ovShape In ActivePage.Shapes
ovShape.CellsSRC(visSectionObject, visRowLock,
visLockSelect).FormulaU = "1"
Next

ActiveDocument.Protection = visProtectShapes

End Sub
 
V

Vivek

Thanks for replying, could you please elaborate on this by giving example in
VB.net

I am using Visio's ActiveX control in vb.net to show the drawing but I want
it to be non-editable but zoomable.

Thanks,
 
P

Phil Hazell

Hi Vivek,

Try this...

In the beginning of the form hosting the control:

Dim WithEvents app As Microsoft.Office.Interop.Visio.Application

When you load your document into the drawing control (mine is called dc):

app = dc.Document.Application()

Then add the following code to the app_VisioIsIdle Event (I have a user cell
called locked to determine if the document is locked from editing):

If ActivePage.PageSheet.Cells("User.locked.Value").Formula.ToLower = "true"
Then
If app.ActiveDocument.Saved = False Then
MsgBox("cannot make changes to locked documents")
app.Undo
app.ActiveDocument.Saved = True
End If
End If

HTH

Phil
 

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