如何DevExpress,GridControl,FocusedRow只改变背景色、不改变ForeColor前景色(change the background not fore colors)...

困扰我好几天的一个问题、今天终于解决了.....................奋斗

GridControl的可以设置FocusedRow的前景色和背景色、但是由于前景色已经动态生成、所以不想被覆盖,英文大致为这样描述

by default the grid changes the cell's ForeColor when the row is focused and painted with a different background (AllowCellFocus turned off). How can I have the focused row still show the original ForeColors of all the cells in the row and not overpaint it with a specific ForeColor for focused rows?

If I do that I can't highlight a focused row with a background color anymore. I want to still be able to change the background on row

focus but I want the fore colors to remain the same as in the unfocused cells.

大致就是:改变FocusedRow的背景色,但是不改变前景色

两步即可:

1、EnableAppearanceFocusedCell = False, EnableAppearanceFocusedRow = False

2、在代码里面给FocusedRow你想要的背景色、

private void gdvMarket_RowCellStyle(object sender, RowCellStyleEventArgs e)
{
if (e.RowHandle == gdvMarket.FocusedRowHandle)
{

e.Appearance.BackColor=Color.CadetBlue;
;
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值