語言

StrokeCollection.Save 方法

定義

節省了 StrokeCollection.

多載

名稱 Description
Save(Stream)

將 StrokeCollection 儲存為指定的 Stream。

Save(Stream, Boolean)

將 StrokeCollection 儲存到指定 Stream 位置,並在指定時壓縮。

Save(Stream)

將 StrokeCollection 儲存為指定的 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)

參數

stream
Stream

Stream該如何保存。StrokeCollection

範例

以下範例示範如何利用此StrokeCollection方法將 a Save(Stream, Boolean) 儲存到檔案中。 此範例假設存在一個 InkCanvas 被呼叫 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

備註

此 Save 方法會 StrokeCollection 儲存為 Ink Serialized Format(ISF)。

適用於

Save(Stream, Boolean)

將 StrokeCollection 儲存到指定 Stream 位置,並在指定時壓縮。

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)

參數

stream
Stream

Stream該如何保存。StrokeCollection

compress
Boolean

true壓縮 StrokeCollection;否則,。 false

範例

以下範例示範如何利用此StrokeCollection方法將 a Save(Stream, Boolean) 儲存到檔案中。 此範例假設存在一個 InkCanvas 被呼叫 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

備註

此 Save 方法會 StrokeCollection 儲存為 Ink Serialized Format(ISF)。

適用於