コード例 #1
0
 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));
     }
 }
コード例 #2
0
        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]);
        }
コード例 #3
0
        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]);
        }