The SerializePassword Property is available in LEADTOOLS Document and Medical Imaging toolkits.
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;} |
C++/CLI | |
---|
public:
virtual property bool SerializePassword {
bool get();
void set ( bool value);
} |
Property 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)
' first create a temporary object collection and copy all objects in the container into it
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)
' we do not want to save the password of locked objects to the clipbaord
destObj.SerializePassword = False
destObjects.Add(destObj)
Next srcObj
' copy this object collection to the clipboard
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)
' check if the clipboard has LEADTOOLS annotations objects
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
' get the object collection from the clipboard
Dim objects As RasterCollection(Of AnnObject) = CType(IIf(TypeOf data.GetData(clipboardFormatName) Is RasterCollection(Of AnnObject), data.GetData(clipboardFormatName), Nothing), RasterCollection(Of AnnObject))
' move the objects from this collection to the container
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 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
See Also