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 form 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 Annotation Security. (Deprecated).
using Leadtools;
using Leadtools.Annotations;
using Leadtools.WinForms;
using Leadtools.Drawing;
public void AnnAutomation_Lock(AnnAutomation automation)
{
// first add a new object to the automation
AnnRectangleObject rectObj = new AnnRectangleObject();
rectObj.Bounds = new AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel);
rectObj.Pen = new AnnPen(Color.Blue, new AnnLength(1, AnnUnit.Pixel));
rectObj.Brush = new AnnSolidBrush(Color.Yellow);
automation.Container.Objects.Add(rectObj);
automation.Viewer.Invalidate(rectObj.InvalidRectangle);
// make sure no objects are selected in the automation
automation.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 added
automation.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 object
if (automation.CanLock)
{
// lock this object
automation.Lock();
}
else if (automation.CanUnlock)
{
// unlock this object
automation.Unlock();
}
else
MessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)");
}
Imports Leadtools
Imports Leadtools.Annotations
Imports Leadtools.WinForms
Imports Leadtools.Drawing
Public Sub AnnAutomation_Lock(ByVal automation As AnnAutomation)
' first add a new object to the automation
Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
rectObj.Bounds = New AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel)
rectObj.Pen = New AnnPen(Color.Blue, New AnnLength(1, AnnUnit.Pixel))
rectObj.Brush = New AnnSolidBrush(Color.Yellow)
automation.Container.Objects.Add(rectObj)
automation.Viewer.Invalidate(rectObj.InvalidRectangle)
' make sure no objects are selected in the automation
automation.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 added
automation.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 Sub
Private Sub LockUnlock(ByVal automation As AnnAutomation)
' first, check if we can lock the object
If automation.CanLock Then
' lock this object
automation.Lock()
ElseIf automation.CanUnlock Then
' unlock this object
automation.Unlock()
Else
MessageBox.Show("Cannot lock or unlock because no object is currently being edited (selected)")
End If
End 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