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

时间:2011-07-21 14:11:56

标签: c# winforms infragistics ultragrid ultrawingrid

目前这就是它的样子:

enter image description here

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

enter image description here

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

有什么想法吗?

3 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

我想你可能正在寻找这样的东西。在这个例子中,我选择了行颜色"消失了#34;但你可以将它们设置为你想要的任何颜色。

'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

答案 2 :(得分: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;
    }