Nevron Forum

How to set diagram read only?

https://www.nevron.com/Forum/Topic8670.aspx

By Boon Kean Chin - Tuesday, July 15, 2014

How to set diagram read only, not allowing user to make any changes to the document? Have to loop all the elements in the diagram?
By Nevron Support - Wednesday, July 16, 2014

You have several options:

1.  Loop all elements and set the respective protections
2. Disable the respective tools  - for example the following code disables the Move tool:

NTool tool = drawingView.Controller.Tools.GetToolByName(NDWFR.ToolMove);
tool.Enabled = false;

3. One dirty trick to disable modifcations is to set an invalid id to the ActiveLayerUniqueId property:
m_View.document.ActiveLayerUniqueId = Guid.NewGuid()

Tools that modify the document always take the active layer into account. If you do not have an active layer, user cannot modify or select anything.