Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
windows 2000 - window 7, how would i use a openfilwdilog1, to search for a shortcut and get the image of the shortcut to appear on the panel1 background image? can anyone help? I can't find it any where on the interwebs
Posted
Comments
Ankit Rajput 4-May-11 3:42am    
Your question is not clear. What do you want exactly to ask?

Try this :
C#
            string path = String.Empty;

            OpenFileDialog openfilwdilog1= new OpenFileDialog();
            if (openfilwdilog1.ShowDialog() == DialogResult.OK)
            {
                path = openfilwdilog1.FileName;
            }

//            Image img = new Bitmap(path);

            panel1.BackgroundImage = Image.FromFile(path);
 
Share this answer
 
v2
Comments
[no name] 4-May-11 5:50am    
I get an error saying, parameter not valid on the [ Image img = new Bitmap(path); ]
Tarun.K.S 4-May-11 8:48am    
That's strange, its working fine here.
Tarun.K.S 4-May-11 8:57am    
I have updated the answer. Check now.
[no name] 4-May-11 21:21pm    
This time is says [ panel1.BackgroundImage = Image.FromFile(path); ] it is out of memory
Tarun.K.S 6-May-11 4:17am    
Is your image too big?
 
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