如何更改Infragistics的UltraGrid过滤器行的背景颜色?

问题描述 投票:7回答:3

目前这是它的样子:

我想改变那种蓝色,但我不知道要改变什么属性。

我已经尝试将我认为的属性改为洋红色,或者试图找出我需要的属性而突出的东西,但到目前为止还没有骰子。

有任何想法吗?

c# winforms infragistics ultragrid ultrawingrid
3个回答
0
投票

使用“ultraGrid.DisplayLayout.Override.FilterCellAppearance”。


0
投票

我想你可能正在寻找这样的东西。在这个例子中,我将选定的行颜色“消失”,但您可以将它们设置为您想要的任何颜色。

'Make selected row look just like any other row
myUltraGrid.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.White
myUltraGrid.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.Black

'Make selected cell look like any other cell
myUltraGrid.DisplayLayout.Override.ActiveCellAppearance.BackColor = Color.Black
myUltraGrid.DisplayLayout.Override.ActiveCellAppearance.ForeColor = Color.White

0
投票

调整外观的最佳方法是在UltraGrid控件的InitializeLayout事件中,而不是调整Designer文件。您可以在设计时双击UltraGrid来挂钩上述事件。之后,您可以评论并取消注释下面的单行,以便在您为控件应用所需的过滤器后,了解最终效果是什么:

 private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
    {
        //If the row is not the ative row, you would see that color instead.
        e.Layout.Override.FilterCellAppearance.BackColor = Color.Green;

        //This would be visible when the row has filters applies, and not being active at the same time.
        e.Layout.Override.FilterCellAppearanceActive.BackColor = Color.GreenYellow;

        //The appearance that would be applied after you filtered IN some of the rows based on your filters.
        e.Layout.Override.FilteredInCellAppearance.BackColor = Color.BlueViolet;

        //After a filter is applied, and FilteredInCellAppearance is not being set.
        e.Layout.Override.FilteredInRowAppearance.BackColor = Color.Pink;

        //If FilterCellAppearance is not being set, the one below would take effect.
        e.Layout.Override.FilterRowAppearance.BackColor = Color.Plum;

        //The formatting of the filter rows, that have active filters already.
        e.Layout.Override.FilterRowAppearanceActive.BackColor = Color.PowderBlue;
    }
© www.soinside.com 2019 - 2024. All rights reserved.