For my DataGrid application, what I need to do was display certain
rows in one background color and certain rows in another based on
changes in one column. I extended the DataGridTextBoxColumn class -
essentially creating my own custom DataGridColoredTextBoxColumn class.
Inside of that class I was able to override the Paint method:
protected override void Paint(System.Drawing.Graphics g,
System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager
source, int rowNum, System.Drawing.Brush backBrush,
System.Drawing.Brush foreBrush, bool alignToRight)
{
and through some other method calls, am indeed able to color the
backgrounds of my rows the way I want. The problems start happening
when I scroll up and down or left and right. The repaint is horrific
- leaving remnants of other cells where new cells just appeared due to
scrolling and the colors get all out of whack )-: Does anyone have
any ideas how to avoid this crappy repaint issue?? I've tried
blocking the base.paint from getting called once the grid has been
painted to my satisfaction, but this leaves me looking at nothing.
Need help - thanks in advance!!