0

你好朋友

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

并且该单元格必须是当前聚焦的单元格。

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

谢谢。。

4

1 回答 1

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 的两个类别的背景颜色。

如果我犯了错误请评论

于 2011-03-06T14:34:54.640 回答