StrokeCollection.Save Method (Stream, Boolean)

 

Saves the StrokeCollection to the specified Stream and compresses it, when specified.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public virtual void Save(
	Stream stream,
	bool compress
)

Parameters

stream
Type: System.IO.Stream

The Stream to which to save the StrokeCollection.

compress
Type: System.Boolean

true to compress the StrokeCollection; otherwise, false.

The Save method saves the StrokeCollection as Ink Serialized Format (ISF).

The following example demonstrates how to save a StrokeCollection to a file by using the Save(Stream, Boolean) method. This example assumes that there is an InkCanvas called inkCanvas1.

private void SaveStrokes_Click(object sender, RoutedEventArgs e)
{
    FileStream fs = null;

    try
    {
        fs = new FileStream(inkFileName, FileMode.Create);
        inkCanvas1.Strokes.Save(fs);
    }
    finally
    {
        if (fs != null)
        {
            fs.Close();
        }
    }
}

.NET Framework
Available since 3.0
Return to top
Show: