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

I'm developing a project which is going to run on Windows CE in an embedded PC.
So I have to use .net framework 2.

How can I add images to an imagelist?
It seems that there is no System.Drawing.Image.FromFile method.
Posted

Try:
C#
Image im = new Bitmap(path);
 
Share this answer
 
Comments
Behno0o0oD 7-Jul-13 6:28am    
The input string is filename, and not path.
OriginalGriff 7-Jul-13 6:38am    
A filename is a path - it's just relative to the application current directory...If all you have is a filename, then you almost certainly need to prefix it with it's directory information...
Behno0o0oD 8-Jul-13 6:26am    
excuse me.
How can I add jpg pictures?
OriginalGriff 8-Jul-13 6:36am    
Look at the documentation on MSDN: the Bitmap constructor accepts a variety of file types, including jpg
C#
string path = Assembly.GetExecutingAssembly().GetName().CodeBase;

char[] address = path.ToCharArray();

string final_address = "";

for (int i = 0; i < address.Length; i++)
{
    final_address += address[i];
}

Image img = new Bitmap(final_address + "1.jpg");

pictureBox1.Image = img;
 
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