Locking the shape

May 16, 2014 at 6:33 AM
Hi

When having a lot of shapes you sometimes want to resizing or movement for some of them to prevent mistakes. For example, if you have picture shape that is behaving like background for some other shapes. Then when you want to move one of the other shapes, but in a hurry you select the picture and move it instead of the desired shape.

Is there already any way to "lock" the shape so it can't be moved or resized?

Thanks,
Zvonko
Coordinator
May 19, 2014 at 8:03 AM
There is no 'lock' feature like in the Visual Studio WinForms designer.
But you could use the buildt in permission system for implementing such a feature:
You can assign a 'Security Domain Name' to a shape (upper case character 'A' to 'Z'). Using the RoleBasedSecurityManager, you can restrict the actions allowed for this domain. Once you assign the domain name to the shape, the actions for the shape will be restricted as the toolbox tools and the controller components will check the permissions for each action.
Please have a look at the demo program 'Security Demo' where you can play around with the permission settings and their effects on the UI.
Feel free to ask if you have further questions.
May 31, 2014 at 9:49 AM
Hi

I took the approach with disabling control points as described in https://nshape.codeplex.com/discussions/540368.
I just disabled all control points for those shapes that have ModelObject.Locked property set to true (I have my own objects for shapes and models). It works perfectly.

Thanks.