'宣言 Public Property CellAppearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase 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 Button121_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button121.Click ' Get the band to have the groups in. Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands(0) ' Clear existing groups if any. band.Groups.Clear() ' Add a group with the key of G1 and the caption of Address Info. band.Groups.Add("G1", "Address Info") ' Add some columns to the group. band.Groups("G1").Columns.Add(band.Columns("CustomerID"), 0) band.Groups("G1").Columns.Add(band.Columns("ContactName"), 1) band.Groups("G1").Columns.Add(band.Columns("City"), 2) band.Groups("G1").Columns.Add(band.Columns("Region"), 3) band.Groups("G1").Columns.Add(band.Columns("Country"), 4) End Sub Private Sub Button120_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button120.Click Dim group As UltraGridGroup = Me.UltraGrid1.DisplayLayout.Bands(0).Groups("G1") ' Set Width to 600. Extent property returns the same value as Width but unlike ' Width, Extent is read-only. group.Width = 600 Debug.WriteLine("Group width = " & group.Width & ", Extent = " & group.Extent) ' Set the appearance of the group header. group.Header.Appearance.BackColor = Color.Red ' You can change the caption by setting the caption. group.Header.Caption = "Group Caption" ' You can also set the appearance of cells in columns that belong to this group. group.CellAppearance.BackColor = Color.LightSkyBlue End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button121_Click(object sender, System.EventArgs e) { // Get the band to have the groups in. UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0]; // Clear existing groups if any. band.Groups.Clear( ); // Add a group with the key of G1 and the caption of Address Info. band.Groups.Add( "G1", "Address Info" ); // Add some columns to the group. band.Groups["G1"].Columns.Add( band.Columns["CustomerID"], 0 ); band.Groups["G1"].Columns.Add( band.Columns["ContactName"], 1 ); band.Groups["G1"].Columns.Add( band.Columns["City"], 2 ); band.Groups["G1"].Columns.Add( band.Columns["Region"], 3 ); band.Groups["G1"].Columns.Add( band.Columns["Country"], 4 ); } private void button120_Click(object sender, System.EventArgs e) { UltraGridGroup group = this.ultraGrid1.DisplayLayout.Bands[0].Groups["G1"]; // Set Width to 600. Extent property returns the same value as Width but unlike // Width, Extent is read-only. group.Width = 600; Debug.WriteLine( "Group width = " + group.Width + ", Extent = " + group.Extent ); // Set the appearance of the group header. group.Header.Appearance.BackColor = Color.Red; // You can change the caption by setting the caption. group.Header.Caption = "Group Caption"; // You can also set the appearance of cells in columns that belong to this group. group.CellAppearance.BackColor = Color.LightSkyBlue; }