StrokeCollection.Save 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
保存 .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该方法将 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 为墨迹序列化格式(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 为墨迹序列化格式(ISF)。