困扰我好几天的一个问题、今天终于解决了.....................
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;
;
}
}
本文介绍如何在GridControl中保持聚焦行的原始前景色不变,仅改变背景色的方法。通过禁用默认的聚焦外观设置并自定义聚焦行的背景色,实现聚焦行突出显示的同时保留原有文字颜色。
1337

被折叠的 条评论
为什么被折叠?



