How can you extend the Bitmap class
        Posted  
        
            by vrish88
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by vrish88
        
        
        
        Published on 2009-04-20T04:45:18Z
        Indexed on 
            2010/05/24
            10:21 UTC
        
        
        Read the original article
        Hit count: 393
        
Hello, I am trying to extend the Bitmap class so that I can apply my own effects to an image. When I use this code:
namespace ImageEditor
{
    public class Effects : System.Drawing.Bitmap
    {
        public void toBlackAndWhite()
        {
            System.Drawing.Bitmap image = (Bitmap)this;
            AForge.Imaging.Filters.Grayscale filter = new AForge.Imaging.Filters.Grayscale();
            this = filter.Apply(this);
        }
    }
}
I get the following error:
'ImageEditor.Effects': cannot derive from sealed type 'System.Drawing.Bitmap'
So is there a way to get around this or is it simply not possible to extend the class?
Thanks.
© Stack Overflow or respective owner