Deriving from System.Drawing.Image troubles...
-
Hey all, I'm trying to create a new EnhancedImage class derived from a System.Drawing Image class, but I keep getting the error "System.Drawing.Image.Image()' is inaccessible due to its protection level". Is it possible that you just can't derive from this class? I posted my code for the class below. It's pretty simple so far, just a constructor. Any thoughts would be appreciated. Thanks.
using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) { FromFile(imageFilename); } } }
-Mike Zinni "No shit it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job." -
Hey all, I'm trying to create a new EnhancedImage class derived from a System.Drawing Image class, but I keep getting the error "System.Drawing.Image.Image()' is inaccessible due to its protection level". Is it possible that you just can't derive from this class? I posted my code for the class below. It's pretty simple so far, just a constructor. Any thoughts would be appreciated. Thanks.
using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) { FromFile(imageFilename); } } }
-Mike Zinni "No shit it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."I have no idea if this would work, but possibly the Image abstract class has its default constructor as private and that is what you are calling, so it may require that you use one of its defined constructors, and I noticed the Bitmap class does not use a default contructor either. I think this would work... if it doesn't, then i have no idea. notice this line: public EnhancedImage(string imageFilename) : base( imageFileName )
using System; using System.Drawing; namespace WindowsApplication1 { /// /// Summary description for EnhancedImage. /// public class EnhancedImage : Image { public EnhancedImage(string imageFilename) : base( imageFileName ) { FromFile(imageFilename); } } }