【发布时间】:2018-03-24 03:44:20
【问题描述】:
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
我正在使用 DevExpress。我声明“DbNull”值应该是“Lightyellow”中的默认颜色。在我想要选择“DbNull”值中的行或单元格来更改蓝色之后。我做错了什么? 我想选择要更改颜色的单元格或行(也为空值)
【问题讨论】:
-
什么应该变成蓝色?整行,还是只是那个单元格?
-
选定的行或单元格要更改为蓝色。(也为空值)
标签: vb.net winforms devexpress xtragrid gridcontrol