简体   繁体   English

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

[英]How can I change the background color of the Infragistics' UltraGrid filter row?

Currently this is what it looks like:目前这是它的样子:

在此处输入图像描述

I'd like to change that blue color, but I don't know what property to change.我想改变那个蓝色,但我不知道要改变什么属性。

在此处输入图像描述

I've tried changing what I think is the property to magenta or something that stands out in an attempt to find out what property I need, but so far no dice.我尝试将我认为的属性更改为洋红色或其他突出的属性,以找出我需要的属性,但到目前为止还没有骰子。

Any ideas?有任何想法吗?

I think you may be looking for something like this.我想你可能正在寻找这样的东西。 In this example I'm making the selected row colors "disappear", but you can set them to any color you want.在此示例中,我将选定的行 colors “消失”,但您可以将它们设置为您想要的任何颜色。

'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

The best way to tweak the appearances would be in the InitializeLayout event of your UltraGrid control, and not tweak the Designer files.调整外观的最佳方法是在 UltraGrid 控件的 InitializeLayout 事件中,而不是调整 Designer 文件。 You could double click on your UltraGrid, while in Design time, to hook to that mentioned event.您可以在设计时双击您的 UltraGrid,以连接到提到的事件。 Afterwards you could comment and uncomment the single lines below to get the idea what would be the end effect for you, after you apply the needed filters for your control:之后,您可以在为您的控件应用所需的过滤器之后,对下面的单行进行注释和取消注释,以了解最终效果是什么:

 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;
    }

Use "ultraGrid.DisplayLayout.Override.FilterCellAppearance" for that.为此使用“ultraGrid.DisplayLayout.Override.FilterCellAppearance”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM