Пример #1
0
        public sealed override void DrawRect(CGRect dirtyRect)
        {
            base.DrawRect(dirtyRect);

            CGContext context = null;

            try
            {
                context = NSGraphicsContext.CurrentContext.CGContext;
                context.SaveState();
                context.TranslateCTM(0F, dirtyRect.Height);
                context.ScaleCTM(1F, -1F);
                using (var ugContext = new UGContext(context, dirtyRect, (float)Window.BackingScaleFactor))
                {
                    DrawOverride(ugContext);
                }
            }
            finally
            {
                if (context != null)
                {
                    context.RestoreState();
                    context.Dispose();
                    context = null;
                }
            }
        }
Пример #2
0
        public sealed override void DrawInContext(CGContext context)
        {
            base.DrawInContext(context);

            using (var ugContext = new UGContext(context, Frame, (float)ContentsScale))
            {
                DrawOverride(ugContext);
            }
        }
Пример #3
0
        public sealed override void Draw(CGRect rect)
        {
            base.Draw(rect);

            using (var context = UIGraphics.GetCurrentContext())
                using (var ugContext = new UGContext(context, rect, (float)ContentScaleFactor))
                {
                    DrawOverride(ugContext);
                }
        }