using System; using System.Drawing; namespace GoldPrinter { public abstract class DrawBase : IDraw, IDisposable { private Graphics _graphics; private Rectangle _rectangle; private Brush _brush; private Pen _pen; public Graphics Graphics { get { return this._graphics; } set { this._graphics = value; } } public Rectangle Rectangle { get { return this._rectangle; } set { this._rectangle = value; } } public Pen Pen { get { return this._pen; } set { if (value != null) { this._pen = value; } } } public Brush Brush { get { return this._brush; } set { if (value != null) { this._brush = value; } } } public abstract void Draw(); public DrawBase() { this._rectangle = new Rectangle(0, 0, 0, 0); this._brush = Brushes.Black; this._pen = new Pen(this._brush); this._pen = Pens.Black; } public virtual void Dispose() { this._brush.Dispose(); this._pen.Dispose(); } } }