UltraGridOverride.RowAppearance および UltraGridOverride.RowAlternateAppearance プロパティを使用して、グリッドの奇数行と偶数行で異なる外観設定を提供します。IsAlternate プロパティは、行でどの外観が使用されるかを示します。 (代わりの外観が指定されていない場合、すべての行は標準の外観を使用し、隔行とそれ以外の行で表示に違いはありません。)
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub Button110_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button110.Click ' Setup the appearance for alternate rows. This will make for easy identification ' of alterante rows. Me.UltraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.LightYellow ' Get the active row. Dim activeRow As UltraGridRow = Me.UltraGrid1.ActiveRow ' Write out whether the active row is alteranate row or not. Debug.WriteLine("ActiveRow.IsAlternate = " & activeRow.IsAlternate) ' Odd indexed rows are alternate rows. Write out whether the row's index is odd or even. If 0 = activeRow.Index Mod 2 Then Debug.WriteLine("ActiveRow's Index of " & activeRow.Index & " is even.") Else Debug.WriteLine("ActiveRow's Index of " & activeRow.Index & " is odd") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button110_Click(object sender, System.EventArgs e) { // Setup the appearance for alternate rows. This will make for easy identification // of alterante rows. this.ultraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.LightYellow; // Get the active row. UltraGridRow activeRow = this.ultraGrid1.ActiveRow; // Write out whether the active row is alteranate row or not. Debug.WriteLine( "ActiveRow.IsAlternate = " + activeRow.IsAlternate ); // Odd indexed rows are alternate rows. Write out whether the row's index is odd or even. if ( 0 == activeRow.Index % 2 ) Debug.WriteLine( "ActiveRow's Index of " + activeRow.Index + " is even." ); else Debug.WriteLine( "ActiveRow's Index of " + activeRow.Index + " is odd" ); }