How can I change the backcolor of a row in a DevExpress GridView?

China☆狼群 提交于 2019-12-23 19:08:29

问题


I have a DevExpress GridView in my form and I need to change some rows color due to a boolean value.

What is the property that allows me to change the backcolor of a row ??


回答1:


You can change the row's color gradient in the RowStyle event handler:

private void myGridView_RowStyle(object sender,
                       DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) 
{
    e.Appearance.BackColor = Color.Green;
    e.Appearance.BackColor2 = Color.LightGreen;
}

See: Customizing Appearances of Individual Rows and Cells




回答2:


You must handle RowStyle or RowCellStyle event of GridView. Form more detail see http://documentation.devexpress.com/#WindowsForms/DevExpressXtraGridViewsGridGridView_RowCellStyletopic and http://documentation.devexpress.com/#WindowsForms/DevExpressXtraGridViewsGridGridView_RowStyletopic.



来源:https://stackoverflow.com/questions/13335135/how-can-i-change-the-backcolor-of-a-row-in-a-devexpress-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!