Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I am using some images it contains my Visual studio --> widowsapplication1--> Resources --> flower.jpg

How can i set the path of image to my program.

panel1.setBackground("???? Path of Image ????");
Posted

Try this code:
VB
panel1.BackgroundImage = Image.FromFile
   (System.Environment.GetFolderPath
   (System.Environment.SpecialFolder.Personal)
   + @"\Resource\Image.gif");
 
Share this answer
 
v2
Comments
vasanthkumarmk 3-Jul-12 8:26am    
how can i set for this same as panel1.SetBackground(????);
C#
// You should replace the bolded image
// in the sample below with an image of your own choosing.
// Note the escape character used (@) when specifying the path.

C#
panel1.BackgroundImage = Image.FromFile
   (System.Environment.GetFolderPath
   (System.Environment.SpecialFolder.Personal)
   + @"\Image.gif");


http://msdn.microsoft.com/en-us/library/tkhesczs.aspx[^]
 
Share this answer
 
C#
panel1.setBackground("~/images/logo.jpg"); 


U r folder name insted of images.
 
Share this answer
 
v2
Comments
vasanthkumarmk 3-Jul-12 8:25am    
Sorry !!! Its not working.......

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