devexpress中gridcontrol 一些样式改变

时间:2021-06-02 17:14:26

改变footer为扁平化效果

整个footer背景色
CustomDrawFooter
e.Appearance.BackColor = Color.Transparent;
e.Appearance.DrawBackground(e.Graphics, e.Cache, e.Bounds);
e.Handled = true;

单个列footer背景
CustomDrawFooterCell
e.Appearance.BackColor = Color.Lavender;
e.Appearance.DrawBackground(e.Graphics, e.Cache, e.Bounds);
e.Appearance.DrawString(e.Cache, e.Info.DisplayText, e.Bounds);
e.Handled = true;
会有几个像素的空隙、

分组(group)时去掉expand button(加号)
CustomDrawGroupRow
e.Appearance.FillRectangle(e.Cache, e.Bounds);
GridGroupRowInfo info = e.Info as GridGroupRowInfo;
e.Bounds.Inflate(-2, 0);
e.Appearance.DrawString(e.Cache, info.GroupText, e.Bounds);
e.Handled = true;