'宣言 Public ReadOnly Property RowLayouts As RowLayoutsCollection
public RowLayoutsCollection RowLayouts {get;}
行レイアウト機能を有効にするには、UseRowLayout プロパティを True に設定します。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create a data table with 3 columns. Dim dt As DataTable = New DataTable("Table1") dt.Columns.Add("Col1", GetType(String)) dt.Columns.Add("Col2", GetType(String)) dt.Columns.Add("Col3", GetType(String)) ' Fill the data table with some random data. Dim i As Integer For i = 0 To 100 - 1 dt.Rows.Add(New String() {"Test" & i + 1, "Test" & i + 2, "Test" & i + 3}) Next ' Set the grid's data source to the data table. Me.UltraGrid1.DataSource = dt Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands("Table1") band.Override.RowSpacingAfter = 5 ' Turn on the row layout functionality for Table1 band. band.RowLayoutStyle = RowLayoutStyle.ColumnLayout ' Create a new row layout with "Horizontal" as the key. Dim horizontalRowLayout As RowLayout = band.RowLayouts.Add("Horizontal") horizontalRowLayout.ColumnInfos("Col1").Initialize(0, 0, 1, 1) horizontalRowLayout.ColumnInfos("Col2").Initialize(1, 0, 1, 1) horizontalRowLayout.ColumnInfos("Col3").Initialize(2, 0, 1, 1) ' Create a new row layout with "Vertical" as the key. Dim verticalRowLayout As RowLayout = band.RowLayouts.Add("Vertical") verticalRowLayout.ColumnInfos("Col1").Initialize(0, 0, 1, 1) verticalRowLayout.ColumnInfos("Col2").Initialize(0, 1, 1, 1) verticalRowLayout.ColumnInfos("Col3").Initialize(0, 2, 1, 1) ' Load the Vertical row-layout. band.RowLayouts("Vertical").Apply() End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged If Me.CheckBox1.Checked Then ' Load the Horizontal row-layout. Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("Horizontal").Apply() Else ' Load the Vertical row-layout. Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("Vertical").Apply() End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void Form1_Load(object sender, System.EventArgs e) { // Create a data table with 3 columns. DataTable dt = new DataTable( "Table1" ); dt.Columns.Add( "Col1", typeof( string ) ); dt.Columns.Add( "Col2", typeof( string ) ); dt.Columns.Add( "Col3", typeof( string ) ); // Fill the data table with some random data. for ( int i = 0; i < 100; i++ ) dt.Rows.Add( new string[] { "Test" + i + 1, "Test" + i + 2, "Test" + i + 3 } ); // Set the grid's data source to the data table. this.ultraGrid1.DataSource = dt; UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands["Table1"]; band.Override.RowSpacingAfter = 5; // Turn on the row layout functionality for Table1 band. band.RowLayoutStyle = RowLayoutStyle.ColumnLayout; // Create a new row layout with "Horizontal" as the key. RowLayout horizontalRowLayout = band.RowLayouts.Add("Horizontal"); horizontalRowLayout.ColumnInfos["Col1"].Initialize( 0, 0, 1, 1 ); horizontalRowLayout.ColumnInfos["Col2"].Initialize( 1, 0, 1, 1 ); horizontalRowLayout.ColumnInfos["Col3"].Initialize( 2, 0, 1, 1 ); // Create a new row layout with "Vertical" as the key. RowLayout verticalRowLayout = band.RowLayouts.Add("Vertical"); verticalRowLayout.ColumnInfos["Col1"].Initialize( 0, 0, 1, 1 ); verticalRowLayout.ColumnInfos["Col2"].Initialize( 0, 1, 1, 1 ); verticalRowLayout.ColumnInfos["Col3"].Initialize( 0, 2, 1, 1 ); // Load the Vertical row-layout. band.RowLayouts["Vertical"].Apply( ); } private void checkBox1_CheckedChanged(object sender, System.EventArgs e) { if ( this.checkBox1.Checked ) { // Load the Horizontal row-layout. this.ultraGrid1.DisplayLayout.Bands[0].RowLayouts["Horizontal"].Apply( ); } else { // Load the Vertical row-layout. this.ultraGrid1.DisplayLayout.Bands[0].RowLayouts["Vertical"].Apply( ); } }