protected override void Paint(System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
    {
        base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
        graphics.FillRectangle(new SolidBrush(cellStyle.BackColor), cellBounds);

        if (internalControl == null)
        {
            internalControl = new CheckedListBox();
        }
        internalControl.Items.Clear();
        ICollection collection = value as ICollection;

        if (collection != null)
        {
            foreach (object obj in collection)
            {
                internalControl.Items.Add(obj);
            }
            Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height);
            internalControl.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
            graphics.DrawImage(bmp, cellBounds, new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);
        }
    }