示例#1
0
        public GdiObjectFactory()
        {
            _fontFactory = new FontFactory(_maxFonts);

            _stringFormatFactory = new MruFactory <CreateStringFormatArgs, StringFormat>(_maxStringFormats,
                                                                                         args => new StringFormat
            {
                Trimming      = args.Trimming,
                Alignment     = args.Alignment,
                LineAlignment = args.LineAlignment,
                FormatFlags   = args.Flags
            });

            _brushFactory = new MruFactory <CreateBrushArgs, Brush>(_maxBrushes, args => new SolidBrush(args.GetColor()));
        }
示例#2
0
 public void Dispose()
 {
     if (_fontFactory != null)
     {
         _fontFactory.Dispose();
         _fontFactory = null;
     }
     if (_stringFormatFactory != null)
     {
         _stringFormatFactory.Dispose();
         _stringFormatFactory = null;
     }
     if (_brushFactory != null)
     {
         _brushFactory.Dispose();
         _brushFactory = null;
     }
 }
示例#3
0
 public FontFactory(int maxObjects = 20)
 {
     _fonts = new MruFactory <ItemKey, Font>(maxObjects, key => new Font(key.Name, key.Size, key.Style, key.Unit));
 }