Hi!
After googling around and looking at previous posts here, I once more must resort to this forum...
I have created a custom DGV where I have implemented an inherited DataGridViewRowHeaderCell class. In this class, I have overrided the Paint method so I don't get that arrow icon in the RowHeaders (paintParts &= ~DataGridViewPaintParts.ContentBackground;) However, when I add headers to the Row header cells, this text doesn't align to the left! Instead, the text starts at the middle of the Row header cell, as if the arrow/star icon was still there.
How can I adjust the row header cells so that they are aligned to the left? I guess I have to modify the paint method further, but how? I have experimented with the cellBounds and clipBounds rectangles but it just turns out very strange...
My current paint method in my custom DataGridViewRowHeaderCell class is as follows:
protected override void Paint(System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
// Remove the part where the background (icon) is drawn from the paintParts object
paintParts &= ~DataGridViewPaintParts.ContentBackground;
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
}