【发布时间】:2016-06-27 03:09:07
【问题描述】:
【问题讨论】:
标签: winforms gridview devexpress
【问题讨论】:
标签: winforms gridview devexpress
我建议您阅读该主题的文档:Customizing Appearances of Individual Rows and Cells。
您可以通过多种方式做到这一点:
可以处理 GridView.RowStyle 事件来自定义外观 GridViews 中的各个行。自定义特定单元格的 外观,请改为处理 GridView.RowCellStyle 事件。这 GridView.RowStyle 事件在 GridView.RowCellStyle 事件之前触发。
例子:
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_RowStyle(object sender,
DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) {
GridView View = sender as GridView;
if(e.RowHandle >= 0) {
string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["Category"]);
if(category == "Beverages") {
e.Appearance.BackColor = Color.Salmon;
e.Appearance.BackColor2 = Color.SeaShell;
}
}
}
参考资料:
Changing Row Colours on DevExpress GridView
希望对您有所帮助..
【讨论】:
你点击GridView,然后点击Theme,你可以从中选择。
【讨论】:
这是您在表单中的 DataGridView 控件中的操作方式。我想应该是相似的,自从我上次使用 DevExpress 已经有一段时间了。但是您应该阅读 DevExpress 的文档,因为所有组件都有很好的文档记录。
foreach (DataGridViewRow row in dgInformation.Rows)
{
if (some criteria here == 1234)
{
row.DefaultCellStyle.BackColor = Color.Goldenrod;
}
}
【讨论】: