/// <summary> /// Raises the MouseUp event /// </summary> /// <param name="e">A CellMouseEventArgs that contains the event data</param> public override void OnMouseUp(I3CellMouseEventArgs e) { base.OnMouseUp(e); // get the button renderer data I3ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // check for the left mouse button if (e.Button == MouseButtons.Left) { Rectangle buttonRect = this.CalcButtonBounds(); // if the mouse pointer is over the button, make sure // the button is "hot" if (buttonRect.Contains(e.X, e.Y)) { rendererData.ButtonState = I3PushButtonStates.Hot; e.Table.Invalidate(e.CellRect); // check if the click started inside the button. if // it did, Raise the tables CellButtonClicked event if (buttonRect.Contains(rendererData.ClickPoint)) { I3Column column = e.Table.ColumnModel.Columns[e.Column]; if (column.GetType() == typeof(I3ButtonColumn)) { I3ButtonColumn buttonColumn = (I3ButtonColumn)column; buttonColumn.OnButtonClicked(new I3CellButtonEventArgs(e.Cell, e.Column, e.Row)); } //e.Table.OnCellButtonClicked(new CellButtonEventArgs(e.Cell, e.Column, e.Row)); } } else { // the mouse was released somewhere outside of the button, // so make set the button back to its normal state if (rendererData.ButtonState != I3PushButtonStates.Normal) { rendererData.ButtonState = I3PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); } } } // reset the click point rendererData.ClickPoint = Point.Empty; }
/// <summary> /// Raises the KeyUp event /// </summary> /// <param name="e">A CellKeyEventArgs that contains the event data</param> public override void OnKeyUp(I3CellKeyEventArgs e) { base.OnKeyUp(e); // get the button renderer data I3ButtonRendererData rendererData = this.GetButtonRendererData(e.Cell); // if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space) { rendererData.ButtonState = I3PushButtonStates.Normal; e.Table.Invalidate(e.CellRect); I3Column column = e.Table.ColumnModel.Columns[e.Column]; if (column.GetType() == typeof(I3ButtonColumn)) { I3ButtonColumn buttonColumn = (I3ButtonColumn)column; buttonColumn.OnButtonClicked(new I3CellButtonEventArgs(e.Cell, e.Column, e.Row)); } } }