Editare

Partajați prin


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.

public:
 void Save(System::IO::Stream ^ stream);
public void Save (System.IO.Stream stream);
member this.Save : System.IO.Stream -> unit
Public Sub Save (stream As 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.

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();
        }
    }
}
Private Sub SaveStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim fs As FileStream = Nothing

    Try
        fs = New FileStream(inkFileName, FileMode.Create)
        inkCanvas1.Strokes.Save(fs)
    Finally
        If Not fs Is Nothing Then
            fs.Close()
        End If
    End Try

End Sub

Remarks

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

Applies to

Save(Stream, Boolean)

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

public:
 virtual void Save(System::IO::Stream ^ stream, bool compress);
public virtual void Save (System.IO.Stream stream, bool compress);
abstract member Save : System.IO.Stream * bool -> unit
override this.Save : System.IO.Stream * bool -> unit
Public Overridable Sub Save (stream As Stream, compress As Boolean)

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.

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();
        }
    }
}
Private Sub SaveStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim fs As FileStream = Nothing

    Try
        fs = New FileStream(inkFileName, FileMode.Create)
        inkCanvas1.Strokes.Save(fs)
    Finally
        If Not fs Is Nothing Then
            fs.Close()
        End If
    End Try

End Sub

Remarks

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

Applies to