BrightIdeasSoftware.BaseRenderer.DrawCheckBox C# (CSharp) Метод

DrawCheckBox() защищенный Метод

Draw the check box of this row
protected DrawCheckBox ( Graphics g, Rectangle r ) : int
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Результат int
        protected virtual int DrawCheckBox(Graphics g, Rectangle r)
        {
            // TODO: Unify this with CheckStateRenderer
            int imageIndex = this.ListItem.StateImageIndex;

            if (this.IsPrinting) {
                if (this.ListView.StateImageList == null || imageIndex < 0)
                    return 0;

                    return this.DrawImage(g, r, this.ListView.StateImageList.Images[imageIndex]) + 4;
            }

            //CheckBoxState boxState = CheckBoxState.UncheckedNormal;
            //int switchValue = (imageIndex << 4) + (this.IsItemHot ? 1 : 0);
            //switch (switchValue) {
            //    case 0x00:
            //        boxState = CheckBoxState.UncheckedNormal;
            //        break;
            //    case 0x01:
            //        boxState = CheckBoxState.UncheckedHot;
            //        break;
            //    case 0x10:
            //        boxState = CheckBoxState.CheckedNormal;
            //        break;
            //    case 0x11:
            //        boxState = CheckBoxState.CheckedHot;
            //        break;
            //    case 0x20:
            //        boxState = CheckBoxState.MixedNormal;
            //        break;
            //    case 0x21:
            //        boxState = CheckBoxState.MixedHot;
            //        break;
            //}

            // The odd constants are to match checkbox placement in native mode (on XP at least)
            r = this.CalculateCheckBoxBounds(g, r);
            CheckBoxState boxState = this.GetCheckBoxState(this.ListItem.CheckState);
            CheckBoxRenderer.DrawCheckBox(g, r.Location, boxState);

            //CheckBoxRenderer.DrawCheckBox(g, new Point(r.X + 3, r.Y + (r.Height / 2) - 6), boxState);
            return CheckBoxRenderer.GetGlyphSize(g, boxState).Width + 6;
        }