I am having a bit of trouble with a property.
I am developing a class "Photo" which has properties etc for a single photo
using System.Drawing;
public Image Imge
{
get
{
try
{
return _Imge;
}
catch
{
Bitmap bm = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(bm);
g.Clear(Color.WhiteSmoke);
Pen p = new Pen(Color.Red, 5);
g.DrawLine(p, 0, 0, 100, 100);
g.DrawLine(p, 100, 0, 0, 100);
return bm;
}
}
set {
using (Image _Imge = Image.FromFile(_FileName))
Imge = value;
}
}
I am trying to write a property that converts a filename to an image.
The problem is the last set statement gives a Cannot implicitly convert type error.
Thanks for any help