colors - Devexpress gridcontrol 改变选中行颜色

标签 colors devexpress rows selected gridcontrol

我正在使用 FormatConditions 根据它们的属性来格式化某些行。例如。我有一个包含很多行的 gridcontrol,当出现错误时,有些行会显示为红色。 The issue I have is that when a row is selected, the formatting disappears and goes blue.

我希望所选行的颜色比该行的颜色略深。 IE。您仍然可以看出该行的阴影颜色是什么,但您也可以看出它已被选中。

执行此操作的最佳方法是什么?

最佳答案

句柄 GridView.CustomDrawCell Event并获取当前 Cell 的状态,无论它是否属于所选行。

//Get State of the cell - e.Cell 提供访问当前单元格来绘制 -

 GridRowCellState state = ((GridCellInfo)e.Cell).State;

然后检查选中的行单元格

if ((state & GridRowCellState.Selected) == GridRowCellState.Selected)
{
// do your custrom drawing here.
// for example 
e.DisplayText = "";
e.Appearance.BorderColor = Color.White;
}

然后设置CustomDrawEventArgs.Handled Property - e.Handled = true or false; 根据您的要求自定义绘制单元格后。

浏览这些文档链接:
Custom Painting Basics
Custom Painting Samples

关于colors - Devexpress gridcontrol 改变选中行颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9307407/

相关文章:

java - Java中文本颜色的意义是什么? (为什么 public/private = red | class = cyan)

c - 褪色功能错误

jquery - 移动应用性能测试工具

php - 如何将多个文件上传插入到mysql中

r - 如何获取特定名称的行索引号?

java - JProgressbar:如何根据进度改变颜色?

colors - 如何在数据库字段中存储颜色?

javascript - RequestLogger 'contains' 方法预期行为

c# - 从 ColumnChooser 隐藏列

c# - WPF DataGrid 行高