/******************************************************************************************* ** **************************************************************** ** ** **********File Name: BrushExt.cs Version 1.0, 8 November 2004** ** ** ****************Author: Kanti Surapaneni************************ ** ** ** ** This class represents the functionality of a brush object. This class extends the ** ** SolidBrush class from the System.Drawing. The BrushExt class includes methods for ** ** getting and setting the properties of the brush object. ** ** It encapsulates functionality for defining the color of the brush object. ** ** ** ********************************************************************************************/ /// using System; using System.Drawing; using System.Drawing.Drawing2D; using System.ComponentModel; using System.Drawing.Design; using System.Collections; // Namespace BaseDef, include BrushExt, PenExt, FontData namespace GraEditor.BaseDef { /// /// Define our own Brush class, use it to store the color /// public class BrushExt { static BrushExt() { solidBrush = new SolidBrush(Color.Transparent);//construct a new brush } public BrushExt() { this.Color = Color.DarkBlue; } public BrushExt(Color color)//set color : this() { this.Color = color; } private static SolidBrush solidBrush;// static SolidBrush variable public Brush Brush //send the color of BrushExt to Solidbrush variable { get { solidBrush.Color = this.Color;//send color to brush variable return solidBrush; } set // set the color of BrushExt with Brush's color { SolidBrush b = value as SolidBrush; //Income value will change to SolidBrush type if(b == null) return; this.Color = b.Color; } } protected Color color;//color property of BrushExt public Color Color { get { return color; } set { //if( value == this.color) // return; this.color = value; //solidBrush.Color = this.color; } } } }