'宣言 Public ReadOnly Property Layouts As LayoutsCollection
public LayoutsCollection Layouts {get;}
UltraGridLayout オブジェクトを永続化して別のオブジェクトに適用する方法の 1 つとして、SaveLayout および LoadLayout メソッドを使用して UltraGridLayout オブジェクトをストレージに保存する方法があります。これらのメソッドを使用せずに UltraGridLayout オブジェクトを永続化する場合は、そのオブジェクトを Layouts コレクションに追加します。こうすると、後でそのオブジェクトを取得して使用できます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button10_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button10.Click ' Add a new layout to the layouts collection. Me.ultraGrid1.Layouts.Add("L1") Me.ultraGrid1.Layouts.Add("L2") ' Setup the "L1" layout. Me.ultraGrid1.Layouts("L1").Override.CellAppearance.BackColor = Color.Maroon Me.ultraGrid1.Layouts("L1").Override.CellAppearance.ForeColor = Color.White ' Setup the "L2" layout. Me.ultraGrid1.Layouts("L2").Override.CellAppearance.BackColor = Color.LightSkyBlue Me.ultraGrid1.Layouts("L2").Override.CellAppearance.ForeColor = Color.DarkBlue ' Copy the "L1" layout to the layout of the ultraGrid1 and "L2" layout to the layout ' of ultraGrid2's. Me.ultraGrid1.DisplayLayout.CopyFrom(Me.ultraGrid1.Layouts("L1")) Me.ultraGrid2.DisplayLayout.CopyFrom(Me.ultraGrid1.Layouts("L2")) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button10_Click(object sender, System.EventArgs e) { // Add a new layout to the layouts collection. this.ultraGrid1.Layouts.Add( "L1" ); this.ultraGrid1.Layouts.Add( "L2" ); // Setup the "L1" layout. this.ultraGrid1.Layouts["L1"].Override.CellAppearance.BackColor = Color.Maroon; this.ultraGrid1.Layouts["L1"].Override.CellAppearance.ForeColor = Color.White; // Setup the "L2" layout. this.ultraGrid1.Layouts["L2"].Override.CellAppearance.BackColor = Color.LightSkyBlue; this.ultraGrid1.Layouts["L2"].Override.CellAppearance.ForeColor = Color.DarkBlue; // Copy the "L1" layout to the layout of the ultraGrid1 and "L2" layout to the layout // of ultraGrid2's. this.ultraGrid1.DisplayLayout.CopyFrom( this.ultraGrid1.Layouts["L1"] ); this.ultraGrid2.DisplayLayout.CopyFrom( this.ultraGrid1.Layouts["L2"] ); }