我想擴展位圖類,以便我可以將自己的效果應用於圖像。當我使用此代碼:如何擴展位圖類
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);
}
}
}
我得到以下錯誤:
'ImageEditor.Effects': cannot derive from sealed type 'System.Drawing.Bitmap'
那麼,有沒有辦法來解決這個問題或者是它根本不可能進行擴展的類?
謝謝。
這將是threatsave? – WiiMaxx 2013-07-23 10:03:54