Share via


Ink.Save Method

Saves the Ink object in InkSerializedFormat (ISF), by using the DefaultCompressionMode and returns the binary data in a Byte array.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Function Save As Byte()
'Usage
Dim instance As Ink 
Dim returnValue As Byte()

returnValue = instance.Save()
public byte[] Save()
public:
array<unsigned char>^ Save()
public function Save() : byte[]

Return Value

Type: array<System.Byte[]
The Byte array that contains the persisted ink.

Examples

In this example, the Dirty property is examined. If true, the Ink object of an InkOverlay object is saved to a file in the default InkSerializedFormat (ISF). An ExtendedProperty is added to the Ink object to track the time that the ink was saved.

Try 
    If mInkOverlay.Ink.Dirty Then 
        ' TIME_GUID is a class level string set via GUID generator 
        Dim timeGuid As Guid = New Guid(TIME_GUID)
        mInkOverlay.Ink.ExtendedProperties.Add(timeGuid, DateTime.Now)
        ' FILE_NAME is a class level const 
        Using FS As FileStream = New FileStream(FILE_NAME, FileMode.Create)
            Dim isf As Byte() = mInkOverlay.Ink.Save()
            FS.Write(isf, 0, isf.Length)
        End Using 
    End If 
Catch 
    ' handle or rethrow 
End Try
try
{
    if (mInkOverlay.Ink.Dirty)
    {
        // TIME_GUID is a class level string set via GUID generator
        Guid timeGuid = new Guid(TIME_GUID);
        mInkOverlay.Ink.ExtendedProperties.Add(timeGuid, DateTime.Now);
        // FILE_NAME is a class level const 
        using (FileStream FS = new FileStream(FILE_NAME, FileMode.Create))
        {
            byte[] isf = mInkOverlay.Ink.Save();
            FS.Write(isf, 0, isf.Length);
        }
    }
}
catch 
{
    // handle or rethrow
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class

Ink Members

Save Overload

Microsoft.Ink Namespace

Ink.Load

PersistenceFormat

CompressionMode