protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (_colorService != null) { _colorService.Dispose(); _colorService = null; } } }
public IUGContext CreateDrawingSession() { var context = Graphics.FromImage(Native); context.PageScale = Scale; context.PageUnit = GraphicsUnit.Pixel; var colorService = new ColorService(); return(new UGContext(context, Size, Scale, colorService, () => { colorService.Dispose(); context.Dispose(); context = null; })); }