且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在流中保存和加载 Ink Canvas StrokeCollection

更新时间:2023-12-01 22:50:04

您是否检查了 Position 你的流?

Did you check the Position of the your stream?

我认为将笔画保存到其中后,它会指向它的结尾.
尝试将位置重置为第一个字符,如下所示:

I think that after saving the stroke into it it will point to the end of it.
Try to reset the position to the first character, like this:

using (MemoryStream ms = new MemoryStream())
{
    inkcanvas.Strokes.Save(ms);
    ms.Position = 0;
    inkcanvas.Strokes = new System.Windows.Ink.StrokeCollection(ms);
}