protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter valueTypeConverter, System.ComponentModel.TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { DataGridViewColumnAdvanced ncol = (DataGridViewColumnAdvanced)GetColumn(); if (ncol.DataType == ColumnDataType.Password) { if (value == null) { return(""); } else if (value == DBNull.Value) { return(""); } else if (value.ToString().Length == 0) { return(""); } else { return("" + (char)0x25CF + (char)0x25CF + (char)0x25CF + (char)0x25CF + (char)0x25CF + (char)0x25CF); } } else { return(base.GetFormattedValue(value, rowIndex, ref cellStyle, valueTypeConverter, formattedValueTypeConverter, context)); } }
public void PrepareEditingControlForEdit(bool selectAll) { DataGridViewColumnAdvanced ncol = GetColumn(); if (FDataType != ncol.DataType) { FDataType = ncol.DataType; if (MainControl != null) { MainControl.Visible = false; MainControl = null; } } FMaxInputLength = ncol.MaxInputLength; CreateMainControl(); disabledchange = true; try { prevvalue = DBNull.Value; if (this.m_dataGridView.CurrentCell.Value != null) { prevvalue = this.m_dataGridView.CurrentCell.Value; } SetValue(prevvalue); prevvalue = GetValue(); } finally { disabledchange = false; } if (this.textcontrol != null) { if (selectAll) { this.textcontrol.SelectAll(); } } if (MainControl != null) { if (MainControl.Visible) { MainControl.Focus(); } } ImageButtonScale = ncol.ImageButtonScale; ImageButton = ncol.ImageButton; }
private DataGridViewColumnAdvanced GetColumn() { DataGridViewColumnAdvanced nresult = null; if (m_dataGridView == null) { return(nresult); } if (m_dataGridView.CurrentCell == null) { return(nresult); } if (m_dataGridView.CurrentCell.ColumnIndex < 0) { return(nresult); } return((DataGridViewColumnAdvanced)m_dataGridView.Columns[m_dataGridView.CurrentCell.ColumnIndex]); }
private void picboxButton_Click(object sender, EventArgs e) { DataGridViewColumnAdvanced ncol = GetColumn(); if (ncol == null) { return; } if (ncol.ButtonClick != null) { object nvalue = GetValue(); bool aresult = ncol.ButtonClick(GetColumn(), ref nvalue); if (aresult) { //SetValue(nvalue); //NotifyChange(); } } }