Locks the object(s) currently being edited (selected).
public virtual void Lock() Public Overridable Sub Lock()
public:virtual void Lock();
Use the CanLock property to determine whether you can currently call this method.
This method opens the AnnAutomationManager.PasswordDialogType window and uses the value entered in this dialog as the password to AnnObject.Lock.
If the AnnAutomationManager.PasswordDialogType value is null (Nothing in VB), this method will not do anything.
For more information, refer to Implementing WPF Annotation Security..
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;private void AnnAutomation_Lock(AnnAutomation automation){// first add a new object to the automationAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.StrokeThickness = 1.0;rectObj.Fill = Colors.Yellow;rectObj.StrokeThickness = 1.0;automation.Container.Children.Add(rectObj);// make sure no objects are selected in the automationautomation.SelectNone();// see if we can lock or unlock the object (this should show a message informing you that no objects are currently selected (bring edited)LockUnlock(automation);// select (edit) the object we have just addedautomation.StartEditing(rectObj, false);// see if we can lock or unlock the object (should show the password dialog to lock the object)LockUnlock(automation);// see if we can lock or unlock the object (should show the password dialog to unlock the object)LockUnlock(automation);}private void LockUnlock(AnnAutomation automation){// first, check if we can lock the objectif (automation.CanLock){// lock this objectautomation.Lock();}else if (automation.CanUnlock){// unlock this objectautomation.Unlock();}elseMessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPrivate Sub AnnAutomation_Lock(ByVal automation As AnnAutomation)' first add a new object to the automationDim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 100, 100)rectObj.Stroke = Colors.BluerectObj.StrokeThickness = 1.0rectObj.Fill = Colors.Yellowautomation.Container.Children.Add(rectObj)' make sure no objects are selected in the automationautomation.SelectNone()' see if we can lock or unlock the object (this should show a message informing you that no objects are currently selected (bring edited)LockUnlock(automation)' select (edit) the object we have just addedautomation.StartEditing(rectObj, False)' see if we can lock or unlock the object (should show the password dialog to lock the object)LockUnlock(automation)' see if we can lock or unlock the object (should show the password dialog to unlock the object)LockUnlock(automation)End SubPrivate Sub LockUnlock(ByVal automation As AnnAutomation)' first, check if we can lock the objectIf automation.CanLock Then' lock this objectautomation.Lock()ElseIf automation.CanUnlock Then' unlock this objectautomation.Unlock()ElseMessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)")End IfEnd Sub
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;using Leadtools.Silverlight.Demos;//using Leadtools.Help;private void AnnAutomation_Lock(AnnAutomation automation){// first add a new object to the automationAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 100, 100);rectObj.Stroke = Colors.Blue;rectObj.StrokeThickness = 1.0;rectObj.Fill = Colors.Yellow;rectObj.StrokeThickness = 1.0;automation.Container.Children.Add(rectObj);// make sure no objects are selected in the automationautomation.SelectNone();// see if we can lock or unlock the object (this should show a message informing you that// no objects are currently selected (being edited)LockUnlock(automation);// select (edit) the object we have just addedautomation.StartEditing(rectObj, false);// see if we can lock or unlock the object (should show the password dialog to lock the object)LockUnlock(automation);// see if we can lock or unlock the object (should show the password dialog to unlock the object)LockUnlock(automation);}private void LockUnlock(AnnAutomation automation){// first, check if we can lock the objectif (automation.CanLock){// lock this objectautomation.Lock();}else if (automation.CanUnlock){// unlock this objectautomation.Unlock();}elseMessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsImports Leadtools.Silverlight.Demos'using Leadtools.Help;Private Sub AnnAutomation_Lock(ByVal automation As AnnAutomation)' first add a new object to the automationDim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 100, 100)rectObj.Stroke = Colors.BluerectObj.StrokeThickness = 1.0rectObj.Fill = Colors.YellowrectObj.StrokeThickness = 1.0automation.Container.Children.Add(rectObj)' make sure no objects are selected in the automationautomation.SelectNone()' see if we can lock or unlock the object (this should show a message informing you that no objects are currently selected (bring edited)LockUnlock(automation)' select (edit) the object we have just addedautomation.StartEditing(rectObj, False)' see if we can lock or unlock the object (should show the password dialog to lock the object)LockUnlock(automation)' see if we can lock or unlock the object (should show the password dialog to unlock the object)LockUnlock(automation)End SubPrivate Sub LockUnlock(ByVal automation As AnnAutomation)' first, check if we can lock the objectIf automation.CanLock Then' lock this objectautomation.Lock()ElseIf automation.CanUnlock Then' unlock this objectautomation.Unlock()ElseMessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)")End IfEnd Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
