Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#WPF将StrokeCollection转换为ImageSource_C#_Wpf - Fatal编程技术网

C#WPF将StrokeCollection转换为ImageSource

C#WPF将StrokeCollection转换为ImageSource,c#,wpf,C#,Wpf,我以字节为单位存储了StrokeCollection。转换回StrokeCollection后,我希望StrokeCollection传输到imagesource以获取图像 private byte[] strokeCollections; public void UpdateImage() { using (Stream stream = new MemoryStream(strokeCollection)) {

我以字节为单位存储了StrokeCollection。转换回StrokeCollection后,我希望StrokeCollection传输到imagesource以获取图像

    private byte[] strokeCollections;

    public void UpdateImage()
    {
        using (Stream stream = new MemoryStream(strokeCollection))
        {
            //converted back to StrokeCollection
            StrokeCollection strokes = new StrokeCollection(stream);
            //Set image control source to strokes image
            DrawingImg.Source = ---.
        }
    }

谢谢。

我编写了一个库,扩展了
StrokeCollection
类来帮助解决此类问题。你可以在这里找到它:

编译库并将dll添加到项目中。使用
InkSharp.Drawing
类和函数
ToImageSource()
。您还可以将其转换为
位图
字节
数组