共用方式為


StrokeCollection.Save 方法

定義

儲存 StrokeCollection

多載

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 至檔案 Save(Stream, Boolean) 。 此範例假設有一個名為 InkCanvasinkCanvas1 的 。

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

如果要壓縮 StrokeCollection,則為 true,否則為 false

範例

下列範例示範如何使用 方法將 儲存 StrokeCollection 至檔案 Save(Stream, Boolean) 。 此範例假設有一個名為 InkCanvasinkCanvas1 的 。

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) 。

適用於