'宣言 Public Property CellAppearance As Infragistics.Win.Appearance
public Infragistics.Win.Appearance CellAppearance {get; set;}
CellAppearance プロパティは、行のすべてのセルの外観の指定に使用します。CellAppearance プロパティに Appearance オブジェクトを割り当てると、行に属するすべてのセルにそのオブジェクトのプロパティが適用されます。CellAppearance プロパティを使用すると、セルに現在割り当てられている外観関連のプロパティを調べたり変更したりできます。次に例を示します。
UltraWinGrid1.Override.CellAppearance.BackColor = vbYellow
UltraGridCell オブジェクトの Appearance プロパティを直接設定すれば、特定のセルの CellAppearance 設定をオーバーライドできます。セルは常に属する行またはバンドの CellAppearance プロパティで指定された Appearance オブジェクトから引き継がれた値よりも独自の Appearance オブジェクトの値を優先して使用します。
CellAppearance プロパティに指定された Appearance オブジェクトのプロパティのいずれかがデフォルト値に設定されている場合は、セルを含む行の Appearance オブジェクトのプロパティが使用されます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button9.Click ' Get the layout, a band, a column, a row and a cell for the demonstration purpose. Dim layout As UltraGridLayout = Me.ultraGrid1.DisplayLayout Dim band As UltraGridBand = layout.Bands(0) Dim column As UltraGridColumn = band.Columns(0) Dim row As UltraGridRow = Me.ultraGrid1.Rows(0) Dim cell As UltraGridCell = row.Cells(column) ' The way the UltraGrid resolves cell appearance is that objects at a lower level ' in the object model hierarchy have higher precedence than objects in higher level. ' For example, a cell has a higher precedence than its row. A row has a higher ' precedence than a column. The precedence order usually is cell, row, column, band, ' layout in decresing precedence order. ' Set grid-wide cell appearance by using the layout's Override. layout.Override.CellAppearance.BackColor = Color.Yellow ' You can override above settings for a a band by setting the ' Override.CellAppearance on the band. This will have higher precedence than ' the layout.Override. band.Override.CellAppearance.BackColor = Color.Magenta ' You can override cell appearance on a column as well so cell-appearance settings ' on both the band and the layout will be ignored. column.CellAppearance.BackColor = Color.Red ' In the same manner, you can override cell-apperance for a row. row.CellAppearance.BackColor = Color.Green ' You can override the cell-appearance for individual cells. cell.Appearance.BackColor = Color.Blue End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button9_Click(object sender, System.EventArgs e) { // Get the layout, a band, a column, a row and a cell for the demonstration purpose. UltraGridLayout layout = this.ultraGrid1.DisplayLayout; UltraGridBand band = layout.Bands[0]; UltraGridColumn column = band.Columns[0]; UltraGridRow row = this.ultraGrid1.Rows[0]; UltraGridCell cell = row.Cells[column]; // The way the UltraGrid resolves cell appearance is that objects at a lower level // in the object model hierarchy have higher precedence than objects in higher level. // For example, a cell has a higher precedence than its row. A row has a higher // precedence than a column. The precedence order usually is cell, row, column, band, // layout in decresing precedence order. // Set grid-wide cell appearance by using the layout's Override. layout.Override.CellAppearance.BackColor = Color.Yellow; // You can override above settings for a a band by setting the // Override.CellAppearance on the band. This will have higher precedence than // the layout.Override. band.Override.CellAppearance.BackColor = Color.Magenta; // You can override cell appearance on a column as well so cell-appearance settings // on both the band and the layout will be ignored. column.CellAppearance.BackColor = Color.Red; // In the same manner, you can override cell-apperance for a row. row.CellAppearance.BackColor = Color.Green; // You can override the cell-appearance for individual cells. cell.Appearance.BackColor = Color.Blue; }