本文介绍了加载完成后运行一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我有这个代码:
hi all
i have this code:
<pre lang="vb">Dim tester As New BitmapImage<br />
Dim imgplate As String = "approot.test.png"<br />
Dim Strm As Stream = Me.GetType().Assembly.GetManifestResourceStream(imgplate)<br />
tester.BeginInit()<br />
tester.StreamSource = Strm<br />
tester.EndInit()<br />
imgPreview.Source = tester<br />
</pre><br />
从嵌入式资源加载图像,如果我从button_click事件调用它,它将起作用,但是如果我从slider_valuechanged事件调用,它将给我这个错误:
to load an image from an embedded resource and it works will if i called it from a button_click event, but if i called it from a slider_valuechanged event it will give me this error:
Property ''UriSource'' or property ''StreamSource'' must be set
在imgpreview.source
所以我认为滑块是在嵌入资源之前加载的??,如果是,我该如何解决,欢迎您提出任何想法:)
on the imgpreview.source
so i think that the slider is loaded before the embedded resource??, if yes how can i work around that, any ideas will be welcome :)
推荐答案
这篇关于加载完成后运行一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!