Leadtools.Annotations Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
ApplyEncryptor Method
See Also  Example
Leadtools.Annotations Namespace > AnnAutomation Class : ApplyEncryptor Method




Applies the encryptor AnnEncryptObject object currently being edited (selected).

Syntax

Visual Basic (Declaration) 
Public Overridable Sub ApplyEncryptor() 
Visual Basic (Usage)Copy Code
Dim instance As AnnAutomation
 
instance.ApplyEncryptor()
C# 
public virtual void ApplyEncryptor()
Managed Extensions for C++ 
public: virtual void ApplyEncryptor(); 
C++/CLI 
public:
virtual void ApplyEncryptor(); 

Example

Visual BasicCopy Code
Public Sub AnnAutomation_ApplyEncryptor(ByVal automation As AnnAutomation)
   ' first add a new encrypt object to the automation
   Dim encrypt As AnnEncryptObject = New AnnEncryptObject()
   encrypt.Bounds = New AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel)
   encrypt.Key = 123
   automation.Container.Objects.Add(encrypt)
   automation.Viewer.Invalidate(encrypt.InvalidRectangle)
   ' make sure no objects are selected in the automation
   automation.SelectNone()

   ' see if we can apply the encryptor or decryptor (this should show a message informing you that no objects are currently selected (bring edited)
   EncryptDecrypt(automation)

   ' select (edit) the object we have just added
   automation.StartEditing(encrypt, False)

   ' see if we can apply the encryptor or decryptor (should apply the encryptor)
   EncryptDecrypt(automation)

   ' see if we can apply the encryptor or decryptor (should apply the decryptor)
   EncryptDecrypt(automation)
End Sub

Private Sub EncryptDecrypt(ByVal automation As AnnAutomation)
   ' first, check if we can apply the encryptor or decryptor
   If automation.CanApplyEncryptor Then
      ' apply the encryptor
      automation.ApplyEncryptor()
      MessageBox.Show("Encryptor has been applied")
   ElseIf automation.CanApplyDecryptor Then
      ' apply the decryptor
      automation.ApplyDecryptor()
      MessageBox.Show("Decryptor has been applied")
   Else
      MessageBox.Show("Cannot apply encryptor or decryptor because no encrypt object is currently being edited (selected)")
   End If
End Sub
C#Copy Code
public void AnnAutomation_ApplyEncryptor(AnnAutomation automation) 

  // first add a new encrypt object to the automation 
  AnnEncryptObject encrypt = new AnnEncryptObject(); 
  encrypt.Bounds = new AnnRectangle(100, 100, 100, 100, AnnUnit.Pixel); 
  encrypt.Key = 123; 
  automation.Container.Objects.Add(encrypt); 
  automation.Viewer.Invalidate(encrypt.InvalidRectangle); 
  // make sure no objects are selected in the automation 
  automation.SelectNone(); 
 
  // see if we can apply the encryptor or decryptor (this should show a message informing you that no objects are currently selected (bring edited) 
  EncryptDecrypt(automation); 
 
  // select (edit) the object we have just added 
  automation.StartEditing(encrypt, false); 
 
  // see if we can apply the encryptor or decryptor (should apply the encryptor) 
  EncryptDecrypt(automation); 
 
  // see if we can apply the encryptor or decryptor (should apply the decryptor) 
  EncryptDecrypt(automation); 

 
private void EncryptDecrypt(AnnAutomation automation) 

  // first, check if we can apply the encryptor or decryptor 
  if(automation.CanApplyEncryptor) 
  { 
     // apply the encryptor 
     automation.ApplyEncryptor(); 
     MessageBox.Show("Encryptor has been applied"); 
  } 
  else if(automation.CanApplyDecryptor) 
  { 
     // apply the decryptor 
     automation.ApplyDecryptor(); 
     MessageBox.Show("Decryptor has been applied"); 
  } 
  else 
     MessageBox.Show("Cannot apply encryptor or decryptor because no encrypt object is currently being edited (selected)"); 
}

Remarks

Use the CanApplyEncryptor property to determine whether you can currently call this method.

This method will call the AnnEncryptObjectApply method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features