Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 11-Sep-12 17:38pm
v2

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
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900