I like to add a gradient brush to each row of my datagridview. I like to change the gradient colors for each row independently depending of some cell values in the row.
I know how to add a solid background color to each, cell, row, column etc. but I do not know how to add a gradient brush to each row individualy.
I need to fill the datagridview with values, the datagridview is disconnected from any database or other data source. After filling the datagridview, I want to step trough each row, find my key values, decide the gradient colors and then add the gradient to the row.
I like to do something similar to what I now do with a background color:
Is this possible? And How do you do this?
I am using VB.NET and VS 2008 and 2010
Peter Schwennesen
I know how to add a solid background color to each, cell, row, column etc. but I do not know how to add a gradient brush to each row individualy.
I need to fill the datagridview with values, the datagridview is disconnected from any database or other data source. After filling the datagridview, I want to step trough each row, find my key values, decide the gradient colors and then add the gradient to the row.
I like to do something similar to what I now do with a background color:
Code:
For Each R As DataGridViewRow In DGV.Rows
Dim CS As New DataGridViewCellStyle
Select Case i
Case 1 : CS.BackColor = Color.Yellow
Case 2 : CS.BackColor = Color.Blue
End Select
R.DefaultCellStyle = CS
Next
I am using VB.NET and VS 2008 and 2010
Peter Schwennesen
Comment