D
dreamkeys
Hi,
At this time I'm able to set the background color of a cell depending
on it's value. I'm able to achieve this by extending the
DataGridTextBoxColumn class and overriding the Paint method:
My problem now is, how can I do this to the full row? At this stage I
know the row number, and the cell, but I don't have any access to the
cells that exist in the same row (or do I?)
Any ideas? I just cannot figure out how to do this...
Thanks ahead for all the help.
Best Regards,
L. Pinho
At this time I'm able to set the background color of a cell depending
on it's value. I'm able to achieve this by extending the
DataGridTextBoxColumn class and overriding the Paint method:
Code:
protected override void Paint(System.Drawing.Graphics g,
System.Drawing.Rectangle bounds, CurrencyManager source, int rowNum,
System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool
alignToRight)
{
if (internalHighlightInformation != null)
{
object objAtRow = GetColumnValueAtRow(source, rowNum);
//(Values A, C and X are just an example, this values
are set at run-time)
if (objAtRow = "B" || objAtRow = "C" || objAtRow =
"X")
{
backBrush = new SolidBrush(Color.Red);
foreBrush = new SolidBrush(Color.White);
}
}
base.Paint(g, bounds, source, rowNum, backBrush,
foreBrush, alignToRight);
}
My problem now is, how can I do this to the full row? At this stage I
know the row number, and the cell, but I don't have any access to the
cells that exist in the same row (or do I?)
Any ideas? I just cannot figure out how to do this...
Thanks ahead for all the help.
Best Regards,
L. Pinho