簡體   English   中英

如何更改 Infragistics 的 UltraGrid 過濾器行的背景顏色?

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

目前這是它的樣子:

在此處輸入圖像描述

我想改變那個藍色,但我不知道要改變什么屬性。

在此處輸入圖像描述

我嘗試將我認為的屬性更改為洋紅色或其他突出的屬性,以找出我需要的屬性,但到目前為止還沒有骰子。

有任何想法嗎?

我想你可能正在尋找這樣的東西。 在此示例中,我將選定的行 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

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM