protected override void OnButtonClicked(object sender, TextBoxButtonCellEventArgs e) { base.OnButtonClicked(sender, e); DataGridViewTextBoxButtonColumn dgvButton = (DataGridViewTextBoxButtonColumn)this.dataGridView.Columns[this.ColumnIndex]; e.RowIndex = rowIndex; e.Value = Value; e.DataGridViewTextBoxButton = this; e.ColumnIndex = this.ColumnIndex; dgvButton.CellButtonClick(sender, e); }
public override object Clone() { DataGridViewTextBoxButtonColumn column1 = (DataGridViewTextBoxButtonColumn)base.Clone(); column1.ColumnKey = this.ColumnKey; column1.ColumnWhere = this.ColumnWhere; column1.ControlWhere = this.ControlWhere; column1.DataCellTypeFormater = this.DataCellTypeFormater; column1.OnCellButtonClick = this.OnCellButtonClick; column1.DataCellType = this.DataCellType; column1.CellTemplate = new DataGridViewTextBoxButtonCell(); return(column1); }
protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter valueTypeConverter, System.ComponentModel.TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { if (value != null) { DataGridViewTextBoxButtonColumn column = this.OwningColumn as DataGridViewTextBoxButtonColumn; if (column != null) { if (column.DataCellType == DataCellType.DateToChar && !string.IsNullOrEmpty(column.DataCellTypeFormater)) { return(TryParse.DateToStrByChar(value, column.DataCellTypeFormater)); } } } return(base.GetFormattedValue(value, rowIndex, ref cellStyle, valueTypeConverter, formattedValueTypeConverter, context)); }
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { // Set the value of the editing control to the current cell value. base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); TextBoxButtonEditingControl ctl = DataGridView.EditingControl as TextBoxButtonEditingControl; DataGridViewTextBoxButtonColumn column = this.OwningColumn as DataGridViewTextBoxButtonColumn; if (column != null) { ctl.DataFormater = column.DataCellType; } ctl.BackColor = dataGridViewCellStyle.SelectionBackColor; ctl.ColumnIndex = this.ColumnIndex; ctl.SelectAll(); }