StrokeCollection.Save Method

Definition

Saves the StrokeCollection.

Overloads

Save(Stream)

Saves the StrokeCollection to the specified Stream.

Save(Stream, Boolean)

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

Save(Stream)

Saves the StrokeCollection to the specified Stream.

C#
public void Save(System.IO.Stream stream);

Parameters

stream
Stream

The Stream to which to save the StrokeCollection.

Examples

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.

C#
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();
        }
    }
}

Remarks

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

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Save(Stream, Boolean)

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

C#
public virtual void Save(System.IO.Stream stream, bool compress);

Parameters

stream
Stream

The Stream to which to save the StrokeCollection.

compress
Boolean

true to compress the StrokeCollection; otherwise, false.

Examples

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.

C#
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();
        }
    }
}

Remarks

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

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10