如何在wpf中克隆WriteableBitmap? [英] How to Clone WriteableBitmap in wpf?

查看:195
本文介绍了如何在wpf中克隆WriteableBitmap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在wpf中克隆WriteableBitmap?
使用此代码来System.Windows.Markup.XamlParseException:找不到类型'System.Windows.Media.Imaging.WriteableBitmap'的默认构造函数。

在我的例如,WriteableBitmap对于创建绘图程序和通过克隆带子项的网格间接克隆是必不可少的。

Sub copyelement(ByVal wr As WriteableBitmap, ByVal wr2 As WriteableBitmap)
        Dim objXaml As String = Markup.XamlWriter.Save(wr)
        Dim StringReader As StringReader = New StringReader(objXaml)
        Dim xmlReader As Xml.XmlReader = Xml.XmlReader.Create(StringReader)
        wr2 = Markup.XamlReader.Load(xmlReader)
End Sub

推荐答案



嗨    Saulius LT,  $


>>如何克隆WriteableBitmap in wpf? 



据我所知,似乎没有办法直接从一个到另一个。



但是你可以使用一个数组并且
CopyPixels
让他们脱离一个然后

WritePixels
让他们进入另一个。





此外,您可以参考
WriteableBitmapEx
。它的功能有一个快速克隆方法来复制WriteableBitmap。



$


最好的问候,


Yong Lu

Hi   Saulius LT, 

>>How to Clone WriteableBitmap in wpf? 

As far as I know, There does not appear to be a way to copy directly from one to another.

But you may can use an array and CopyPixels to get them out of one and then WritePixels to get them into another.


Besides, you can refer the WriteableBitmapEx. It's Features have a fast Clone method to copy a WriteableBitmap.



Best Regards,

Yong Lu


这篇关于如何在wpf中克隆WriteableBitmap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆