Leadtools.Windows.Annotations Requires Document/Medical license. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Lock Method
See Also  Example
Leadtools.Windows.Annotations Namespace > AnnObjectBase Class : Lock Method



password
String containing the password used to lock the annotation object.
password
String containing the password used to lock the annotation object.
Locks this AnnObjectBase with the specified password.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub Lock( _
   ByVal password As String _
) 
Visual Basic (Usage)Copy Code
Dim instance As AnnObjectBase
Dim password As String
 
instance.Lock(password)
C# 
public virtual void Lock( 
   string password
)
C++/CLI 
public:
virtual void Lock( 
   String^ password
) 

Parameters

password
String containing the password used to lock the annotation object.

Example

This method changes the 'lock' state of an object.

Visual BasicCopy Code
Public Sub AnnObject_Lock(ByVal obj As AnnObjectBase, ByVal password As String)
   If obj.IsLocked Then
      MessageBox.Show("Object is locked. It will be unlocked.")
      If String.Compare(password, obj.Password, False) <> 0 Then
         MessageBox.Show("Invalid password!!")
      Else
         obj.Unlock(password)
      End If
   Else
      MessageBox.Show("Object was not locked. It will be locked now.")
      obj.Lock(password)
   End If
End Sub
C#Copy Code
public void AnnObject_Lock(AnnObjectBase obj, string password) 

   if(obj.IsLocked) 
   { 
      MessageBox.Show("Object is locked. It will be unlocked."); 
      if(string.Compare(password, obj.Password, false) != 0) 
         MessageBox.Show("Invalid password!!"); 
      else 
         obj.Unlock(password); 
   } 
   else 
   { 
      MessageBox.Show("Object was not locked. It will be locked now."); 
      obj.Lock(password); 
   } 
}

Remarks

Only unlocked objects can be locked. If an object is already locked, it will stay locked with its original password. You must pass the same password to AnnObjectBase.Unlock to unlock this AnnObjectBase.

If this method succeeds, password will be stored inside the object and can be retreived with the Password property.

An object must be unlocked in order to change that object in automated mode.

For more information, refer to Implementing WPF Annotation Security.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also

Lock requires a Document/Medical product license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features and Unlocking Special LEAD Features.