Exemple #1
0
        public HatchBrush GetHatchBrush(HatchStyle hatchStyle, Color_ foreColor, Color_ backColor)
        {
            string hash = ((int)hatchStyle).ToString() + foreColor.ToString() + backColor.ToString();

            lock (hatchbrushes) {
                HatchBrush brush = (HatchBrush)hatchbrushes[hash];
                if (brush == null)
                {
                    brush = new HatchBrush(hatchStyle, foreColor, backColor);
                    hatchbrushes.Add(hash, brush);
                }
                return(brush);
            }
        }
Exemple #2
0
        public Pen GetSizedPen(Color_ color, int size)
        {
            string hash = color.ToString() + size;

            lock (sizedpens) {
                Pen res = sizedpens [hash] as Pen;
                if (res != null)
                {
                    return(res);
                }

                Pen pen = new Pen(color, size);
                sizedpens [hash] = pen;
                return(pen);
            }
        }
Exemple #3
0
        public Pen GetDashPen(Color_ color, DashStyle dashStyle)
        {
            string hash = color.ToString() + dashStyle;

            lock (dashpens) {
                Pen res = dashpens [hash] as Pen;
                if (res != null)
                {
                    return(res);
                }

                Pen pen = new Pen(color);
                pen.DashStyle   = dashStyle;
                dashpens [hash] = pen;
                return(pen);
            }
        }