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

示例

下面的示例演示如何使用 Save(Stream, Boolean) 方法将 保存到StrokeCollection文件中。 此示例假定有一个名为 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

注解

方法 SaveStrokeCollection 保存为墨迹序列化格式 (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

示例

下面的示例演示如何使用 Save(Stream, Boolean) 方法将 保存到StrokeCollection文件中。 此示例假定有一个名为 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

注解

方法 SaveStrokeCollection 保存为墨迹序列化格式 (ISF) 。

适用于