StrokeCollection.Save Metoda

Definicja

Zapisuje element StrokeCollection.

Przeciążenia

Save(Stream)

Zapisuje element StrokeCollection w określonym Streamobiekcie .

Save(Stream, Boolean)

Zapisuje element StrokeCollection w określonym Stream pliku i kompresuje go po określeniu.

Save(Stream)

Zapisuje element StrokeCollection w określonym Streamobiekcie .

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)

Parametry

stream
Stream

Element Stream , do którego ma być zapisywany element StrokeCollection.

Przykłady

W poniższym przykładzie pokazano, jak zapisać element StrokeCollection w pliku przy użyciu Save(Stream, Boolean) metody . W tym przykładzie założono, że istnieje InkCanvas nazwa .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

Uwagi

Metoda Save zapisuje StrokeCollection format ink serialized Format (ISF).

Dotyczy

Save(Stream, Boolean)

Zapisuje element StrokeCollection w określonym Stream pliku i kompresuje go po określeniu.

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)

Parametry

stream
Stream

Element Stream , do którego ma być zapisywany element StrokeCollection.

compress
Boolean

truew celu skompresowania StrokeCollection; w przeciwnym razie . false

Przykłady

W poniższym przykładzie pokazano, jak zapisać element StrokeCollection w pliku przy użyciu Save(Stream, Boolean) metody . W tym przykładzie założono, że istnieje InkCanvas nazwa .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

Uwagi

Metoda Save zapisuje StrokeCollection format ink serialized Format (ISF).

Dotyczy