'宣言 Public Class LayoutsCollection Inherits Infragistics.Shared.KeyedSubObjectsCollectionBase
public class LayoutsCollection : Infragistics.Shared.KeyedSubObjectsCollectionBase
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"] ); }