改变XtraGridView单元格的背景色

时间:2011-03-06 07:32:08

标签: vb.net winforms xtragrid

HEllo朋友

我想更改 DevXpress的XtraGridView特定单元格的背景颜色。

细胞必须是当前聚焦细胞。

怎么做?任何人都可以帮我解决这个问题吗?

thanx ..

1 个答案:

答案 0 :(得分:0)

此链接应该有帮助

http://documentation.devexpress.com/#WindowsForms/CustomDocument758

在示例中,我将查看此特定代码。

导入DevExpress.XtraGrid.Views.Grid

Private Sub GridView1_RowStyle(ByVal sender As Object, _
ByVal e As DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs) Handles GridView1.RowStyle
    Dim View As GridView = sender
    If (e.RowHandle >= 0) Then
        Dim category As String = View.GetRowCellDisplayText(e.RowHandle, View.Columns("Category"))
        If category = "Beverages" Then
            e.Appearance.BackColor = Color.Salmon
            e.Appearance.BackColor2 = Color.SeaShell
        End If
    End If
End Sub

这段代码似乎有助于帮助编程改变Bevarage两个类别的背景颜色。

如果我犯了错误,请发表评论