How to get a valid Image

  • Thread starter Thread starter Martijn Mulder
  • Start date Start date
M

Martijn Mulder

At startup my application loads an image from a file from disk. If the file
is not there, I still need a valid System.Drawing.Image object but I don't
know how to get one.




//class MyImage
class MyImage
{

//data member image
System.Drawing.Image image;

//constructor
public Image():this(@"c:\Some Directory\Some Image.jpg"){}
public Image(string a)
{
try
{
image=System.Drawing.Image.FromFile(a);
}
catch
{
image=...
}
}
}
 
Back
Top