protected override void OnMouseClick(DataGridViewCellMouseEventArgs e) { Point cellLocation = DataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location; cellLocation.Offset(e.Location); if (buttonBounds.Contains(cellLocation)) { UITypeEditor editor = OwningDesignerColumn.GetBoundPropertyEditor(); if (editor != null && editor.GetEditStyle() == UITypeEditorEditStyle.Modal) { ITypeDescriptorContext context = new TypeDescriptorContext(DataGridView.Site, OwningDesignerColumn.GetBoundProperty(), this); object value = GetValue(e.RowIndex); value = editor.EditValue(context, DataGridView.Site, value); SetValue(e.RowIndex, value); } // Notify the grid the cell was modified DataGridView.NotifyCurrentCellDirty(true); DataGridView.NotifyCurrentCellDirty(false); } else { base.OnMouseClick(e); } }
private bool HasStandardValues() { TypeConverter converter = OwningDesignerColumn.GetBoundPropertyConverter(); return(converter != null && converter.GetStandardValuesSupported()); }