C#WPF将StrokeCollection转换为ImageSource
我以字节为单位存储了StrokeCollection。转换回StrokeCollection后,我希望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)) {
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()
。您还可以将其转换为位图
和字节
数组