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





Defines an annotation encrypt object.

Object Model







Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class AnnEncryptObject 
   Inherits AnnRectangleObject
   Implements IAnnPrimarySecondaryPictureObject 
Visual Basic (Usage)Copy Code
Dim instance As AnnEncryptObject
C++/CLI 
[SerializableAttribute()]
public ref class AnnEncryptObject : public AnnRectangleObject, IAnnPrimarySecondaryPictureObject  
XAML Object Element Usage 

<AnnEncryptObject .../>

XAML Object Element Usage 

<AnnEncryptObject .../>

Example

This example creates an encrypt object.

Visual BasicCopy Code
'''<!--This example creates an encrypt object.-->
Private Sub AnnEncryptObject_AnnEncryptObject(ByVal viewer As BitmapSourceViewer, ByVal container As AnnContainer)
   Dim encryptor As AnnEncryptObject = New AnnEncryptObject()
   encryptor.Left = 100
   encryptor.Top = 100
   encryptor.Width = 300
   encryptor.Height = 300
   encryptor.Key = 123
   encryptor.Encryptor = True
   container.Children.Add(encryptor)
   MessageBox.Show(String.Format("Added encryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", encryptor.Encryptor, encryptor.IsEncrypted, encryptor.CanEncrypt, encryptor.CanDecrypt, container.Children.Count))

   ' apply (encryptor)
   encryptor.Apply(viewer)
   MessageBox.Show(String.Format("Applied encryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", encryptor.Encryptor, encryptor.IsEncrypted, encryptor.CanEncrypt, encryptor.CanDecrypt, container.Children.Count))

   ' remove from the container
   container.Children.Remove(encryptor)
   MessageBox.Show(String.Format("Removed encryptor. Objects in container: {0}", container.Children.Count))

   ' create another encrypt object to decrypt the first object
   Dim decryptor As AnnEncryptObject = New AnnEncryptObject()
   decryptor.Left = 100
   decryptor.Top = 100
   decryptor.Width = 300
   decryptor.Height = 300
   decryptor.Key = 123
   decryptor.Encryptor = False
   container.Children.Add(decryptor)
   MessageBox.Show(String.Format("Added decryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", decryptor.Encryptor, decryptor.IsEncrypted, decryptor.CanEncrypt, decryptor.CanDecrypt, container.Children.Count))

   ' apply (decryptor)
   decryptor.Apply(viewer)
   MessageBox.Show(String.Format("Applied decryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", decryptor.Encryptor, decryptor.IsEncrypted, decryptor.CanEncrypt, decryptor.CanDecrypt, container.Children.Count))

   ' remove from the container
   container.Children.Remove(decryptor)
   MessageBox.Show(String.Format("Removed decryptor. Objects in container: {0}", container.Children.Count))
End Sub
C#Copy Code
private void AnnEncryptObject_AnnEncryptObject(BitmapSourceViewer viewer, AnnContainer container) 

   AnnEncryptObject encryptor = new AnnEncryptObject(); 
   encryptor.Left = 100; 
   encryptor.Top = 100; 
   encryptor.Width = 300; 
   encryptor.Height = 300; 
   encryptor.Key = 123; 
   encryptor.Encryptor = true; 
   container.Children.Add(encryptor); 
   MessageBox.Show(String.Format("Added encryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", encryptor.Encryptor, encryptor.IsEncrypted, encryptor.CanEncrypt, encryptor.CanDecrypt, container.Children.Count)); 
 
   // apply (encryptor) 
   encryptor.Apply(viewer); 
   MessageBox.Show(String.Format("Applied encryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", encryptor.Encryptor, encryptor.IsEncrypted, encryptor.CanEncrypt, encryptor.CanDecrypt, container.Children.Count)); 
 
   // remove from the container 
   container.Children.Remove(encryptor); 
   MessageBox.Show(String.Format("Removed encryptor. Objects in container: {0}", container.Children.Count)); 
 
   // create another encrypt object to decrypt the first object 
   AnnEncryptObject decryptor = new AnnEncryptObject(); 
   decryptor.Left = 100; 
   decryptor.Top = 100; 
   decryptor.Width = 300; 
   decryptor.Height = 300; 
   decryptor.Key = 123; 
   decryptor.Encryptor = false; 
   container.Children.Add(decryptor); 
   MessageBox.Show(String.Format("Added decryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", decryptor.Encryptor, decryptor.IsEncrypted, decryptor.CanEncrypt, decryptor.CanDecrypt, container.Children.Count)); 
 
   // apply (decryptor) 
   decryptor.Apply(viewer); 
   MessageBox.Show(String.Format("Applied decryptor. Encryptor: {0}, IsEncrypted: {1}, CanEncrypt: {2}, CanDecrypt: {3}, Objects in container: {4}", decryptor.Encryptor, decryptor.IsEncrypted, decryptor.CanEncrypt, decryptor.CanDecrypt, container.Children.Count)); 
 
   // remove from the container 
   container.Children.Remove(decryptor); 
   MessageBox.Show(String.Format("Removed decryptor. Objects in container: {0}", container.Children.Count)); 
}

Remarks

The encrypt annotation object is a rectangular object that is used to encrypt rectangular portions of an image.

It can also be used to encrypt the entire image. In design mode, the encrypt object is visible but partially transparent to show the part of the image that it covers. In run mode, the encrypt object is invisible.

You must call AnnEncryptObject.Apply to apply the encrypt object. Once applied, the portion of the image under the encrypt object becomes scrambled, and the encrypt object state changes to decryptor. Using different keys before calling this method gives different scrambling patterns. The decryptor state differs from the encryptor state in that a decryptor cannot be moved, and cannot be changed to an encryptor. The scrambling can be removed by calling AnnEncryptObject.Apply on the decrypt object with the appropriate arguments. If successful, the decryptor state changes to encryptor. An encrypt object in the encryptor state can be moved, can have its Key changed, and can be changed to a decrypt object.

The encrypt object is useful for encrypting portions of an image. After encrypting, the scrambled bitmap cannot easily be unscrambled without the associated annotation file. The scrambling can be removed by using the associated annotation file, or by using automation mode to manually change the state from encryptor to a decryptor, position it correctly, and setting the Key appropriately.

Overlapping regions can be encrypted. When encrypting overlapping regions, note the following points:

  • All annotation objects have an order in which they are drawn (the Z-order)
  • The encryptors are encrypted from the front of the Z-order to the back
  • Those that are drawn first are encrypted first. Those that are drawn last ("on top" of other encryptors) are encrypted last
  • The Z-order can be changed through automation by right-clicking and choosing "Send To Front" or "Send To Back"
  • The decrypt objects are decrypted in reverse order of the encrypt objects

You cannot rotate an encrypt object, but you can flip or reverse it. If you rotate a container that includes an encrypt object, the encrypt object will move to the new position, but will retain its orientation.

This class implements the IAnnPrimarySecondaryPictureObject interface to handle primary and secondary pictures.

For more information, refer to Using Primary and Secondary Pictures in WPF Annotation Objects.

If you are interested in locking an object, refer to Implementing Annotation Security.

For more information about the encrypt annotation object refer to the AnnEncryptObject for WPF. For more information about the automated encrypt annotation object, refer to WPF Annotation Objects - Automated Features, WPF Automated Annotations - Encrypt Tab. and WPF Automated Annotations - Encrypt Pictures Tab.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  Leadtools.Windows.Annotations.AnnObjectBase
                     Leadtools.Windows.Annotations.AnnRectangleObject
                        Leadtools.Windows.Annotations.AnnEncryptObject

Requirements

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

See Also

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