public override bool Equals(object obj) { if (obj is CDVColor) { CDVColor c = (CDVColor)obj; return(A == c.A && R == c.R && G == c.G && B == c.B); } else { return(base.Equals(obj)); } }
public static Brush GetBrush(CDVColor color) { if (Brushes.ContainsKey(color)) { return(Brushes[color]); } Color c = Color.FromArgb(color.A, color.R, color.G, color.B); Brushes[color] = new SolidBrush(c); return(Brushes[color]); }
public static Pen GetPen(int width, CDVColor color) { if (width < 1) { width = 1; } if (width > 100) { width = 100; } string key = string.Format("{0}/{1}/{2}/{3}/{4}", width, color.A, color.R, color.G, color.B); if (Pens.ContainsKey(key)) { return(Pens[key]); } Color c = Color.FromArgb(color.A, color.R, color.G, color.B); Pens[key] = new Pen(c, width / 10f); return(Pens[key]); }