DE
Dennis
April 18, 2002 01:23 PM UTC
Well if you succeed please post it here, I am very curious how it is done.
CB
Clay Burch
Syncfusion Team
April 21, 2002 11:29 AM UTC
You might try not changing the background color in your Paint override if the rowNum passed in is selected. I added this code to the sample in our Windows Forms FAQ about coloring individual cells and it allowed the highlighting of selected cells to go through OK.
try
{
if(!this.DataGridTableStyle.DataGrid.IsSelected(rowNum))
{
object o = this.GetColumnValueAtRow(source, rowNum);
if( o!= null)
{
char c = ((string)o)[0];
if( c > 'F')
{
// could be as simple as
// backBrush = new SolidBrush(Color.Pink);
// or something fnacier...
backBrush = new LinearGradientBrush(bounds,
Color.FromArgb(255, 200, 200),
Color.FromArgb(128, 20, 20),
LinearGradientMode.BackwardDiagonal);
foreBrush = new SolidBrush(Color.White);
}
}
}
}
catch(Exception ex){ /* empty catch */ }
finally{
// make sure the base class gets called to do the drawing with
// the possibly changed brushes
base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
}
CB
Clay Burch
Syncfusion Team
April 21, 2002 11:45 AM UTC
Also in the sample in our Windows Forms FAQ, setting the GridLineColor property on the tablestyle seems to work as well.
// make the dataGrid use our new tablestyle and bind it to our table
dataGrid1.TableStyles.Clear();
tableStyle.GridLineColor = Color.Red; //change gridline color added*****
dataGrid1.TableStyles.Add(tableStyle);
dataGrid1.DataSource = _dataSet.Tables["customers"];