Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a reactanle on my wpf form named rectGear


Now im trying to fill with the rectanle with an image

C#
ImageBrush g_modeImageBrush = new ImageBrush();

g_modeImageBrush.ImageSource = new BitmapImage(new Uri(@"/Plug_in_Charging.png", UriKind.Relative));

rectGear.Fill = g_modeImageBrush;


Image is located under the project.


But Im getting FileNotFoundException

Any help regarding this.
Posted
Updated 2-Jul-12 5:20am
v2

1 solution

 
Share this answer
 
Comments
explorerC 2-Jul-12 11:42am    
Thank you damith.......it worked

ImageBrush g_buttonBackGrnd2 = new ImageBrush();
g_buttonBackGrnd2.ImageSource = new BitmapImage(new Uri("pack://application:,,,/file.png", UriKind.Absolute));
tempBtn.Background = g_buttonBackGrnd2;
DamithSL 2-Jul-12 12:11pm    
Great! I'm glad I could help you

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