WinForm VS2003 DataGrid column / row / cell colors
-
Hi, this is a repost from earlier. Using WinForms in VS2003 and a DataGrid, how do I control the *color* for individual columns / rows / cells. I don't see any properties in DataGrid, DataTable, DataView, or DataGridTableStyle. Thanks.
-
Hi, this is a repost from earlier. Using WinForms in VS2003 and a DataGrid, how do I control the *color* for individual columns / rows / cells. I don't see any properties in DataGrid, DataTable, DataView, or DataGridTableStyle. Thanks.
Is this what you're looking for? DataGrid grid = new DataGrid(); //First Row BackColor grid.Items[0].BackColor = Color.Red; //First Row First Cell grid.Items[0].Cells[0].BackColor = Color.Green; As for changing the column's color I think you need to loop though each row for a particular cell and change the color that way... I'm not really sure if there is a better way to do it. e.g. //Change Column color for first cell foreach(DataRow row in grid.Rows) { row.Cells[0].BackColor = Color.Blue; }
Cheers Disgyza Programmer Analyst