Hello!
I have a issue with the cellPaint-Event (virtualmodus is off).
In the Event I call a method where I draw the Background and the text of a cell. If the first cell of the current row has a special Tag, then I want to draw the text across all columns.
Therefore I use the bounds-Property of the RowElement.
But instead of drawing the text from the first cell across all other columns, the text is drawn within each cell. Why does this happen?
I explicitly set the Graphics.Clip to the Bounds of the RowElement.
See attached image for the issue.
There is also another issue where the background is drawn "behind" the scrollbar.
Just by the way: Can I set a ColumnSpan for a specific cell?
Here is my code for painting the cell:
Thanks in advance!
I have a issue with the cellPaint-Event (virtualmodus is off).
In the Event I call a method where I draw the Background and the text of a cell. If the first cell of the current row has a special Tag, then I want to draw the text across all columns.
Therefore I use the bounds-Property of the RowElement.
But instead of drawing the text from the first cell across all other columns, the text is drawn within each cell. Why does this happen?
I explicitly set the Graphics.Clip to the Bounds of the RowElement.
See attached image for the issue.
There is also another issue where the background is drawn "behind" the scrollbar.
Just by the way: Can I set a ColumnSpan for a specific cell?
Here is my code for painting the cell:
private
void
drawTitle(GridViewCellPaintEventArgs e)
{
var groupText = grid.Rows[e.Cell.RowIndex].Cells[0].Tag
as
string
;
var font =
new
Font(SystemFonts.MessageBoxFont, FontStyle.Regular | FontStyle.Underline);
//region to draw is the entire row
e.Graphics.Clip =
new
System.Drawing.Region(e.Cell.RowElement.Bounds);
e.Graphics.Clear(Color.PeachPuff);
e.Graphics.DrawString(groupText, font, Brushes.Blue, Point.Empty);
e.Cell.RowElement.DrawBorder =
false
;
e.Cell.RowElement.BorderWidth = 0;
e.Cell.DisableHTMLRendering =
true
;
e.Cell.CanFocus =
false
;
}
Thanks in advance!