Compartilhar via


StrokeCollection.Save Método

Definição

Salva o StrokeCollection.

Sobrecargas

Save(Stream)

Salva o StrokeCollection no Stream especificado.

Save(Stream, Boolean)

Salva o StrokeCollection no Stream especificado e o compacta, quando indicado.

Save(Stream)

Salva o StrokeCollection no Stream especificado.

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)

Parâmetros

stream
Stream

O Stream no qual salvar o StrokeCollection.

Exemplos

O exemplo a seguir demonstra como salvar um StrokeCollection arquivo usando o Save(Stream, Boolean) método. Este exemplo pressupõe que haja um InkCanvas chamado 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

Comentários

O Save método salva o StrokeCollection isf (formato serializado à tinta).

Aplica-se a

Save(Stream, Boolean)

Salva o StrokeCollection no Stream especificado e o compacta, quando indicado.

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)

Parâmetros

stream
Stream

O Stream no qual salvar o StrokeCollection.

compress
Boolean

true para compactar o StrokeCollection; caso contrário, false.

Exemplos

O exemplo a seguir demonstra como salvar um StrokeCollection arquivo usando o Save(Stream, Boolean) método. Este exemplo pressupõe que haja um InkCanvas chamado 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

Comentários

O Save método salva o StrokeCollection isf (formato serializado à tinta).

Aplica-se a