显示装配体中的gif图像 [英] Displaying gif image from assembly

查看:68
本文介绍了显示装配体中的gif图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在wpf页面上显示程序集的gif图像.
我需要在控件图片框内显示图像.任何人都可以通过

Hi ,I need to display a gif image from assembly on my wpf page.
i need to display the image within the control picturebox.. anybody please help me with this

推荐答案

大家好,
我不知道它是否是正确的解决方案....但是我发现它的工作正常.

这是我的解决方案,我正在逐步提供解决方案


1.将引用windows.forms和form.integration添加到您的wpf项目中
2.引入名称空间
xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration; assembly = WindowsFormsIntegration"

xmlns:winForms ="clr-namespace:System.Windows.Forms; assembly = System.Windows.Forms">

这会将表单属性与wpf集成.
现在我们可以在wpf
中自由使用基于表单的控件picturebox 3.
< wfi:windowsformshost xmlns:wfi =#unknown">
< winforms:图片框x:name ="pictureBox" xmlns:x =#unknown" xmlns:winforms =#unknown">



4.获取执行程序集和图片框的输入图像源作为流后.

System.Reflection.Assembly组件= System.Reflection.Assembly.GetExecutingAssembly();

System.IO.Stream stream =(System.IO.Stream)assembly.GetManifestResourceStream("MyProjectLibrary.Images.blink.gif");

pictureBox.Image = System.Drawing.Image.FromStream(stream);

还有
感谢MehdiGholam的参考链接
Hi everybody,
i don''t know if its the right solution.... but i found its working fine.

Here is my solution and i am giving it step by step


1.Add references windows.forms and form.integration to your wpf project
2.introduce namespaces
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"

xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">

This integrates form properties with wpf.
now we can freely use the form based control picturebox within wpf
3.
<wfi:windowsformshost xmlns:wfi="#unknown">
<winforms:picturebox x:name="pictureBox" xmlns:x="#unknown" xmlns:winforms="#unknown">



4.After it obtain the executing assembly and the input image source for picturebox as stream..

System.Reflection.Assembly assembly=System.Reflection.Assembly.GetExecutingAssembly();

System.IO.Stream stream = (System.IO.Stream)assembly.GetManifestResourceStream("MyProjectLibrary.Images.blink.gif");

pictureBox.Image = System.Drawing.Image.FromStream(stream);

And
my thanks to MehdiGholam for the reference link


从此处开始: http: //msdn.microsoft.com/zh-CN/library/aa970494.aspx [

这篇关于显示装配体中的gif图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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