12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- ///
- 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
- {
-
- /// <summary>
- /// Define our own Brush class, use it to store the color
- /// </summary>
- 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;
-
- }
- }
- }
- }
|