2011-03-06 71 views
0

朋友你好改变XtraGridView细胞的背景色

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

而且细胞必须是当前聚焦的细胞。

如何做到这一点?有人能帮我解决这个问题吗?

感谢名单..

回答

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两个categoris的背景色的情况。

请评论,如果我犯了一个错误

+0

看到这个http://stackoverflow.com/questions/30166372/vb-net-xtragrid-change-cell-color-after-its-value-is-edited – 2015-05-12 11:19:49