public override void DrawRect(NSRect dirtyRect)
        {
            bool shouldDraw = true;

            using (var graphics = Graphics.FromHwnd(this.Handle))
            {
                var events = new PaintEventArgs(graphics, Util.NSRectToRectangle(dirtyRect));
                Host.Draw(events);
                shouldDraw = !events.Handled;
            }
            if (shouldDraw)
            {
                base.DrawRect(dirtyRect);
            }
        }
Exemple #2
0
        public override void DrawRow(NSInteger row, NSRect clipRect)
        {
            bool shouldDraw = true;

            using (var graphics = Graphics.FromHwnd(this.Handle))
            {
                var events = new DrawItemEventArgs(graphics,
                                                   this.Font.ToFont(),
                                                   Util.NSRectToRectangle(clipRect),
                                                   (int)row,
                                                   getState(row));
                if (Host is ListBox)
                {
                    ((ListBox)Host).DrawItemInternal(events);
                }
                shouldDraw = !events.Handled;
            }
            if (shouldDraw)
            {
                base.DrawRow(row, clipRect);
            }
        }