예제 #1
0
        /// <summary>
        /// Raises the KeyDown event
        /// </summary>
        /// <param name="e">A CellKeyEventArgs that contains the event data</param>
        public override void OnKeyDown(CellKeyEventArgs e)
        {
            base.OnKeyDown(e);

            if (e.KeyData == Keys.Space && e.Table.IsCellEditable(e.CellPos))
            {
                // get the renderer data
                CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell);

                //
                if (e.Cell.CheckState == CheckState.Checked)
                {
                    rendererData.CheckState = CheckBoxStates.CheckedPressed;
                }
                else if (e.Cell.CheckState == CheckState.Indeterminate)
                {
                    rendererData.CheckState = CheckBoxStates.MixedPressed;
                }
                else                 //if (e.Cell.CheckState == CheckState.Unchecked)
                {
                    rendererData.CheckState = CheckBoxStates.UncheckedPressed;
                }

                e.Table.Invalidate(e.CellRect);
            }
        }
예제 #2
0
 /// <summary>
 /// Fired when any key up happens
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void table_CellKeyUp(object sender, CellKeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         RowCollection rows = e.Table.TableModel.Rows;
         rows.Remove(rows[e.Row]);
     }
 }
예제 #3
0
        /// <summary>
        /// Raises the KeyDown event
        /// </summary>
        /// <param name="e">A CellKeyEventArgs that contains the event data</param>
        public override void OnKeyDown(CellKeyEventArgs e)
        {
            base.OnKeyDown(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            //
            if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space)
            {
                rendererData.ButtonState = PushButtonStates.Pressed;

                e.Table.Invalidate(e.CellRect);
            }
        }
예제 #4
0
        /// <summary>
        /// Raises the KeyUp event
        /// </summary>
        /// <param name="e">A CellKeyEventArgs that contains the event data</param>
        public override void OnKeyUp(CellKeyEventArgs e)
        {
            base.OnKeyUp(e);

            // get the button renderer data
            ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell);

            //
            if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space)
            {
                rendererData.ButtonState = PushButtonStates.Normal;

                e.Table.Invalidate(e.CellRect);
                e.Table.OnCellButtonClicked(new CellButtonEventArgs(e.Cell, e.Column, e.Row));
            }
        }
예제 #5
0
        /// <summary>
        /// Raises the KeyUp event
        /// </summary>
        /// <param name="e">A CellKeyEventArgs that contains the event data</param>
        public override void OnKeyUp(CellKeyEventArgs e)
        {
            base.OnKeyUp(e);

            if (e.KeyData == Keys.Space && e.Table.IsCellEditable(e.CellPos))
            {
                // get the renderer data
                CheckBoxRendererData rendererData = this.GetCheckBoxRendererData(e.Cell);

                //
                if (e.Cell.CheckState == CheckState.Checked)
                {
                    if (!e.Cell.ThreeState || !(e.Table.ColumnModel.Columns[e.Column] is CheckBoxColumn) ||
                        ((CheckBoxColumn)e.Table.ColumnModel.Columns[e.Column]).CheckStyle == CheckBoxColumnStyle.RadioButton)
                    {
                        rendererData.CheckState = CheckBoxStates.UncheckedNormal;
                        e.Cell.CheckState       = CheckState.Unchecked;
                    }
                    else
                    {
                        rendererData.CheckState = CheckBoxStates.MixedNormal;
                        e.Cell.CheckState       = CheckState.Indeterminate;
                    }
                }
                else if (e.Cell.CheckState == CheckState.Indeterminate)
                {
                    rendererData.CheckState = CheckBoxStates.UncheckedNormal;
                    e.Cell.CheckState       = CheckState.Unchecked;
                }
                else                 //if (e.Cell.CheckState == CheckState.Unchecked)
                {
                    rendererData.CheckState = CheckBoxStates.CheckedNormal;
                    e.Cell.CheckState       = CheckState.Checked;
                }

                e.Table.Invalidate(e.CellRect);
            }
        }
예제 #6
0
 /// <summary>
 /// Raises the KeyUp event
 /// </summary>
 /// <param name="e">A CellKeyEventArgs that contains the event data</param>
 public virtual void OnKeyUp(CellKeyEventArgs e)
 {
 }
예제 #7
0
 /// <summary>
 /// Raises the KeyDown event
 /// </summary>
 /// <param name="e">A CellKeyEventArgs that contains the event data</param>
 public virtual void OnKeyDown(CellKeyEventArgs e)
 {
 }