如何更改Infragistics的UltraGrid筛选行背景颜色?

8

目前显示的样子如下:

enter image description here

我想改变那个蓝色,但我不知道要改变哪个属性。

enter image description here

我尝试更改我认为是该属性的属性,将其更改为品红色或其他醒目的颜色以找出需要的属性,但到目前为止没有用。

有什么好的建议吗?

3个回答

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事件中进行,而不是调整设计文件。您可以在设计时双击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;
    }

0
使用 "ultraGrid.DisplayLayout.Override.FilterCellAppearance" 来实现此功能。

我已经尝试使用那个,但颜色仍然是蓝色的。我需要在特定的事件或其他地方更改此设置吗? - Only Bolivian Here
不。请确保没有其他更深层次的设置覆盖它。为此,您应该查看窗体的*.designer.cs文件并展开区域。为了确保,请删除您无法获得的所有选项(将其注释掉)。 - Alexander Schmidt
1
你需要小心。如果不正确地更改设计文件,可能会破坏你的实际表单。 - Luke

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接