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())); }
public void Dispose() { if (_fontFactory != null) { _fontFactory.Dispose(); _fontFactory = null; } if (_stringFormatFactory != null) { _stringFormatFactory.Dispose(); _stringFormatFactory = null; } if (_brushFactory != null) { _brushFactory.Dispose(); _brushFactory = null; } }
public FontFactory(int maxObjects = 20) { _fonts = new MruFactory <ItemKey, Font>(maxObjects, key => new Font(key.Name, key.Size, key.Style, key.Unit)); }