Gets or sets a value indicating whether the password is saved when this
AnnObject is serialized.
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable Property SerializePassword As Boolean |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As AnnObject
Dim value As Boolean
instance.SerializePassword = value
value = instance.SerializePassword
|
C# | |
---|
public virtual bool SerializePassword {get; set;} |
Managed Extensions for C++ | |
---|
public: __property virtual bool get_SerializePassword();
public: __property virtual void set_SerializePassword(
bool value
); |
C++/CLI | |
---|
public:
virtual property bool SerializePassword {
bool get();
void set (bool value);
} |
Return Value
true if this password is saved when this
AnnObject is serialized; false otherwise.
Example
This example will implement copying/pasting all objects from a container to the clipboard.
Visual Basic | Copy Code |
---|
Private Shared ReadOnly clipboardFormatName As String = "LeadtoolsAnnotations"
Public Sub AnnObject_SerializePassword(ByVal container As AnnContainer)
Dim destObjects As RasterCollection(Of AnnObject) = New RasterCollection(Of AnnObject)()
For Each srcObj As AnnObject In container.Objects
Dim destObj As AnnObject = CType(IIf(TypeOf srcObj.Clone() Is AnnObject, srcObj.Clone(), Nothing), AnnObject)
destObj.SerializePassword = False
destObjects.Add(destObj)
Next srcObj
Dim format As DataFormats.Format = DataFormats.GetFormat(clipboardFormatName)
Dim dataObj As DataObject = New DataObject(clipboardFormatName, destObjects)
Clipboard.SetDataObject(dataObj)
End Sub
Private Sub PasteObjectsFromClipboard(ByVal container As AnnContainer)
Dim data As IDataObject = Clipboard.GetDataObject()
If Not data Is Nothing Then
Dim format As DataFormats.Format = DataFormats.GetFormat(clipboardFormatName)
If data.GetDataPresent(clipboardFormatName) Then
Dim objects As RasterCollection(Of AnnObject) = CType(IIf(TypeOf data.GetData(clipboardFormatName) Is RasterCollection(Of AnnObject), data.GetData(clipboardFormatName), Nothing), RasterCollection(Of AnnObject))
Do While objects.Count > 0
Dim obj As AnnObject = objects(0)
objects.RemoveAt(0)
container.Objects.Add(obj)
Loop
End If
End If
End Sub
|
C# | Copy Code |
---|
/// private static readonly string clipboardFormatName = "LeadtoolsAnnotations"; public void AnnObject_SerializePassword(AnnContainer container) { // first create a temporary object collection and copy all objects in the container into it RasterCollection<AnnObject> destObjects = new RasterCollection<AnnObject>(); foreach(AnnObject srcObj in container.Objects) { AnnObject destObj = srcObj.Clone() as AnnObject; // we do not want to save the password of locked objects to the clipbaord destObj.SerializePassword = false; destObjects.Add(destObj); } // copy this object collection to the clipboard DataFormats.Format format = DataFormats.GetFormat(clipboardFormatName); DataObject dataObj = new DataObject(clipboardFormatName, destObjects); Clipboard.SetDataObject(dataObj); } private void PasteObjectsFromClipboard(AnnContainer container) { // check if the clipboard has LEADTOOLS annotations objects IDataObject data = Clipboard.GetDataObject(); if(data != null) { DataFormats.Format format = DataFormats.GetFormat(clipboardFormatName); if(data.GetDataPresent(clipboardFormatName)) { // get the object collection from the clipboard RasterCollection<AnnObject> objects = data.GetData(clipboardFormatName) as RasterCollection<AnnObject>; // move the objects from this collection to the container while(objects.Count > 0) { AnnObject obj = objects[0]; objects.RemoveAt(0); container.Objects.Add(obj); } } } } |
Remarks
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