Ink.Save Method
Ink.Save Method |
Converts the Ink object to the specified format, saves it by using the specified compression format, and returns the binary data in a Byte array.
Definition
Visual Basic .NET | Public Function Save( _ ByVal p As PersistenceFormat, _ ByVal c As CompressionMode _ ) As Byte() |
---|---|
C# | public byte[] Save( PersistenceFormat p, CompressionMode c ); |
Managed C++ | public: Byte* Save( PersistenceFormat *p, CompressionMode *c ) __gc[]; |
Parameters
p |
Microsoft.Ink.PersistenceFormat. A memeber of the PersistenceFormat enumeration that indicates the format of the persisted ink.
|
||||||||
c |
Microsoft.Ink.CompressionMode. A member of the CompressionMode enumeration that specifies the compression mode of the persisted ink.
|
Return Value
System.Byte[]. Returns the Byte array that contains the persisted ink.
Exceptions
ObjectDisposedException : The Ink object is disposed.
Remarks
Attempting to save an empty Ink object in GIF format generates an error.
Note: When calling the Save method with the p parameter set to Base64InkSerializedFormat, the return value is a null-terminated byte array. To write the saved ink to an XML file, first remove the last byte from the array before converting the array to an 8-bit Unicode Transformation Format (UTF-8)-encoded string.
Examples
[C#]
This C# example saves the Ink object in the InkCollector object, theInkCollector, in a Byte array, theSavedInk. The example later restores the ink in a new Ink object, theNewInk. The ink is stored in Ink Serialized Format (ISF) using the maximum compression.
byte [] theSavedInk = theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat, CompressionMode.Maximum); // ... Ink theNewInk = new Ink(); theNewInk.Load(theSavedInk);
[Visual Basic .NET]
This Microsoft® Visual Basic® .NET example saves the Ink object in the InkCollector object, theInkCollector, in a Byte array, theSavedInk. The example later restores the ink in a new Ink object, theNewInk. The ink is stored in ISF using the maximum compression.
Dim theSavedInk () as Byte = _ theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat, _ CompressionMode.Maximum) '... Dim theNewInk As New Ink() theNewInk.Load(theSavedInk)
See Also