←Select platform

ApplyAllEncryptors Method

Summary

Applies all the encryptor AnnEncryptObject objects in this AnnAutomation.

Syntax

C#
VB
C++
public virtual void ApplyAllEncryptors() 
  
Public Overridable Sub ApplyAllEncryptors()  
public: 
virtual void ApplyAllEncryptors();  

Remarks

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

This method will call the AnnEncryptObjectApply(RasterImageViewer) method for all AnnEncryptObject objects that have the AnnEncryptObject.CanEncrypt value set to true.

Example

C#
VB
using Leadtools; 
using Leadtools.Annotations; 
using Leadtools.WinForms; 
using Leadtools.Drawing; 
 
public void AnnAutomation_ApplyAllEncryptors(AnnAutomation automation) 
{ 
   // remove all objects from this automation 
   automation.SelectAll(); 
   automation.Delete(); 
 
   // see if we can apply all the encryptor or decrytor objects (this should show a message informing you there are no encrypt objects in this automation) 
   EncryptDecryptAll(automation); 
 
   // first add a new a couple of 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); 
 
   encrypt = new AnnEncryptObject(); 
   encrypt.Bounds = new AnnRectangle(300, 300, 100, 100, AnnUnit.Pixel); 
   encrypt.Key = 456; 
   automation.Container.Objects.Add(encrypt); 
   automation.Viewer.Invalidate(encrypt.InvalidRectangle); 
 
   // see if we can apply all encryptor objects (should apply the encryptors) 
   EncryptDecryptAll(automation); 
 
   // see if we can apply all decryptor objects (should apply the decryptors) 
   EncryptDecryptAll(automation); 
} 
 
private void EncryptDecryptAll(AnnAutomation automation) 
{ 
   if (automation.CanApplyAllEncryptors) 
   { 
      // apply encryptors 
      automation.ApplyAllEncryptors(); 
      MessageBox.Show("Encryptor objects has been applied"); 
   } 
   else if (automation.CanApplyAllDecryptors) 
   { 
      // apply decryptors 
      automation.ApplyAllDecryptors(); 
      MessageBox.Show("Decryptor objects has been applied"); 
   } 
   else 
      MessageBox.Show("Cannot apply encryptors or decryptors because no encrypt object is currently in this automation"); 
} 
Imports Leadtools 
Imports Leadtools.Annotations 
Imports Leadtools.WinForms 
Imports Leadtools.Drawing 
 
Public Sub AnnAutomation_ApplyAllEncryptors(ByVal automation As AnnAutomation) 
   ' remove all objects from this automation 
   automation.SelectAll() 
   automation.Delete() 
 
   ' see if we can apply all the encryptor or decrytor objects (this should show a message informing you there are no encrypt objects in this automation) 
   EncryptDecryptAll(automation) 
 
   ' first add a new a couple of 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) 
 
   encrypt = New AnnEncryptObject() 
   encrypt.Bounds = New AnnRectangle(300, 300, 100, 100, AnnUnit.Pixel) 
   encrypt.Key = 456 
   automation.Container.Objects.Add(encrypt) 
   automation.Viewer.Invalidate(encrypt.InvalidRectangle) 
 
   ' see if we can apply all encryptor objects (should apply the encryptors) 
   EncryptDecryptAll(automation) 
 
   ' see if we can apply all decryptor objects (should apply the decryptors) 
   EncryptDecryptAll(automation) 
End Sub 
 
Private Sub EncryptDecryptAll(ByVal automation As AnnAutomation) 
   If automation.CanApplyAllEncryptors Then 
      ' apply encryptors 
      automation.ApplyAllEncryptors() 
      MessageBox.Show("Encryptor objects has been applied") 
   ElseIf automation.CanApplyAllDecryptors Then 
      ' apply decryptors 
      automation.ApplyAllDecryptors() 
      MessageBox.Show("Decryptor objects has been applied") 
   Else 
      MessageBox.Show("Cannot apply encryptors or decryptors because no encrypt object is currently in this automation") 
   End If 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations Assembly