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

icomxhvb  于 2022-12-19  发布在  其他
关注(0)|答案(3)|浏览(265)

现在它看起来是这样的:

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

我试着将我认为的属性更改为洋红色或其他突出的属性,试图找出我需要的属性,但到目前为止没有骰子。
有什么想法吗?

70gysomp

70gysomp1#

使用“超网格.显示布局.覆盖.筛选单元格外观”来实现。

ergxz8rk

ergxz8rk2#

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

'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
iezvtpos

iezvtpos3#

调整外观的最佳方法是在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;
    }

相关问题