【问题标题】:How can I change the background color of the Infragistics' UltraGrid filter row?如何更改 Infragistics 的 UltraGrid 过滤器行的背景颜色?
【发布时间】:2011-10-10 06:48:00
【问题描述】:

目前是这样的:

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

我尝试将我认为的属性更改为洋红色或突出的属性,以找出我需要的属性,但到目前为止还没有骰子。

有什么想法吗?

【问题讨论】:

    标签: c# winforms infragistics ultrawingrid


    【解决方案1】:

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

    【讨论】:

    • 我尝试过使用它,但颜色仍然是蓝色。是否有一些特定的地方我必须更改此设置?在特定事件或其他事情之前?
    • 没有。请确保没有其他更深层次的设置覆盖它。为此,您应该查看表单的 *.designer.cs 文件并展开区域。可以肯定的是,删除您没有得到的所有选项(将它们注释掉)。
    • 你要小心。如果操作不当,更改设计器文件可能会破坏您的实际表单
    【解决方案2】:

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

    '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
    

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 2014-08-04
        • 1970-01-01
        • 2021-12-30
        • 1970-01-01
        • 1970-01-01
        • 2016-03-15
        • 1970-01-01
        • 2013-05-15
        • 1970-01-01
        相关资源
        最近更新 更多