protected override object GetFormattedValue( object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { VerifiedConditionItem item = GetItem(rowIndex); return(item?.IssueCount ?? 0); }
protected override void Paint( Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { using (Brush brush = new SolidBrush(cellStyle.BackColor)) { graphics.FillRectangle(brush, cellBounds); } VerifiedConditionItem item = GetItem(rowIndex); var column = DataGridView?.Columns[ColumnIndex] as DataGridViewIssueCountColumn; if (column == null || item == null) { return; } if (column.MaximumIssueCount <= 0) { return; } double factor = (cellBounds.Width - column.Margin - column.Margin) / (double)column.MaximumIssueCount; Draw(cellBounds.Top + 2, cellBounds.Height - 4, column.Margin + cellBounds.Left, item.IssueCount, graphics, GetColor(item.IssueType, column), factor); }