vb.net 根据内容设置DataGridView行背景色
''设置特殊行背景色
Private Sub DataGridView1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If Me.DataGridView1.Columns(e.ColumnIndex).Name = "备注" Then
If e.Value IsNot Nothing Then
If e.Value = "黑名单" Then
Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.YellowGreen
End If
End If
End If
End Sub
- 上一篇 »CSS布局与定位——height百分比设置无效/背景色不显示
- 下一篇 »css的过渡背景色