Private Sub GridView1_RowCellStyle(sender As Object, e As
RowCellStyleEventArgs) Handles GridView1.RowCellStyle
Try
If IsDBNull(e.CellValue) Then
e.Appearance.BackColor = Color.LightYellow
End If
Dim selectedCells As GridCell() = GridView1.GetSelectedCells()
isRowSelected = GridView1.IsRowSelected(e.RowHandle)
For Each Cells In selectedCells
If GridView1.GetSelectedCells.Count = 1 Then
If IsDBNull(GridView1.GetRowCellValue(Cells.RowHandle,
Cells.Column)) Then
e.Appearance.BackColor = Color.LightYellow
End If
Else
If isRowSelected Then
If IsDBNull(GridView1.GetRowCellValue(Cells.RowHandle,
Cells.Column)) Then
e.Appearance.BackColor = Color.FromArgb(226, 234,
253)
End If
End If
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
XtraGrid中细胞和行选择使用的DevExpress的WinForms Vb.net
我使用的DevExpress。我声明“的DBNull的价值应该是“Lightyellow'.After默认颜色我想成为选择行或“DbNull”值中的单元格更改蓝色。我做错了什么? 我想要选择单元格或行来改变颜色(即null值)
什么应该变成蓝色?整排,还是那个细胞? – greenTree
被选中的行或单元格将被更改为蓝色(即Null值也是) –