Ejemplo n.º 1
0
        /// <summary>
        /// Paints the Cells background
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(I3PaintCellEventArgs e)
        {
            this.OnPaintBackgroundNotVirtual(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell))
            {
                I3ComboBoxStates   comboBoxState = this.GetDropDownRendererData(e.Cell).ButtonState;
                I3PushButtonStates state         = (I3PushButtonStates)comboBoxState;

                if (!e.Enabled)
                {
                    state = I3PushButtonStates.Disabled;
                }

                //ThemeManager.DrawComboBoxButton(e.Graphics, this.CalcDropDownButtonBounds(), state);
                Rectangle rect = this.CalcDropDownButtonBounds();
                I3ThemeManager.DrawButton(e.Graphics, rect, state);

                if (state == I3PushButtonStates.Pressed)
                {
                    rect.X      += 1;
                    rect.Y      += 1;
                    rect.Width  -= 1;
                    rect.Height -= 1;
                }
                e.Graphics.DrawString(I3ExtendCellRenderer.ButtonText, this.buttonFont, this.buttonBrush, rect, this.buttonStringFormat);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Raises the PaintBackground event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(I3PaintCellEventArgs e)
        {
            base.OnPaintBackground(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            // get the button state
            I3ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);
            I3PushButtonStates   state        = rendererData.ButtonState;

            // if the cell has focus and is in its normal state,
            // make the button look like a default button
            if (state == I3PushButtonStates.Normal && e.Focused)
            {
                state = I3PushButtonStates.Default;
            }

            // if the table is not enabled, make sure the button is disabled
            if (!e.Enabled)
            {
                state = I3PushButtonStates.Disabled;
            }

            // draw the button
            I3ThemeManager.DrawButton(e.Graphics, this.CalcButtonBounds(), state);
        }