Private Sub customerDataGridView_CellFormatting(ByVal sender As Object, ByVal e AsDataGridViewCellFormattingEventArgs) Handles customerDataGridView.CellFormatting
If Me.customerDataGridView.Columns(e.ColumnIndex).Name = "" Then
If e.Value IsNot Nothing Then
If e.Value.ToString = "" e.CellStyle.BackColor = Color.Yellow
End If
End If
End If
End Sub
Private Sub dataGridView1_CellPainting(ByVal sender As Object, ByVal e As DataGridViewCellPaintingEventArgs)
Using brush As New SolidBrush(Color.Red)
e.Graphics.FillRectangle(brush, e.CellBounds)
e.Handled = True
End Using
End Sub
Private Sub datagidview1_CellFormatting(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles datagidview1.CellFormatting
If Not IsDBNull(e.Value) Then
Select Case datagidview1.Rows(e.RowIndex).Cells("TX_FLAG").Value.ToString.Trim
Case "0", "2"
e.CellStyle.ForeColor = Color.Blue
Case "3"
e.CellStyle.ForeColor = Color.Red
End Select
.....
Else
e.Value = ""
End If
End Sub
试试看,数据多的时候慢不。