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 5 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)) dt.Columns.Add("Col4", GetType(String)) dt.Columns.Add("Col5", GetType(String)) ' Fill the data table with some random data. Dim random As Random = New Random() Dim i As Integer For i = 0 To 100 - 1 Dim rowData(4) As String Dim j As Integer For j = 0 To 5 - 1 rowData(j) = random.Next(1000).ToString() Next dt.Rows.Add(rowData) Next ' Set the grid's data source to the data table. Me.UltraGrid1.DataSource = dt ' Get the columns of Table1 band in the UltraGrid. Dim gridColumns As ColumnsCollection = Me.UltraGrid1.DisplayLayout.Bands("Table1").Columns ' Turn on the row layout functionality for Table1 band. Me.UltraGrid1.DisplayLayout.Bands("Table1").RowLayoutStyle = RowLayoutStyle.ColumnLayout ' Prevent the user from resizing the cells/labels. Me.UltraGrid1.DisplayLayout.Bands("Table1").Override.AllowRowLayoutCellSizing = RowLayoutSizing.None Me.UltraGrid1.DisplayLayout.Bands("Table1").Override.AllowRowLayoutLabelSizing = RowLayoutSizing.None ' Setup Col1 column. gridColumns("Col1").RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative gridColumns("Col1").RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative ' Setup Col2 column. gridColumns("Col2").RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative gridColumns("Col2").RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative gridColumns("Col2").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder ' Setup Col3 column. gridColumns("Col3").RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative gridColumns("Col3").RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative ' Setup Col4 column. gridColumns("Col4").RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative gridColumns("Col4").RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative gridColumns("Col4").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder ' Setup Col5 column. gridColumns("Col5").RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative gridColumns("Col5").RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative gridColumns("Col5").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder 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 5 columns. DataTable dt = new DataTable( "Table1" ); dt.Columns.Add( "Col1", typeof( string ) ); dt.Columns.Add( "Col2", typeof( string ) ); dt.Columns.Add( "Col3", typeof( string ) ); dt.Columns.Add( "Col4", typeof( string ) ); dt.Columns.Add( "Col5", typeof( string ) ); // Fill the data table with some random data. Random random = new Random( ); for ( int i = 0; i < 100; i++ ) { string[] rowData = new string[ 5 ]; for ( int j = 0; j < 5; j++ ) rowData[j] = random.Next( 1000 ).ToString( ); dt.Rows.Add( rowData ); } // Set the grid's data source to the data table. this.ultraGrid1.DataSource = dt; // Get the columns of Table1 band in the UltraGrid. ColumnsCollection gridColumns = this.ultraGrid1.DisplayLayout.Bands["Table1"].Columns; // Turn on the row layout functionality for Table1 band. this.ultraGrid1.DisplayLayout.Bands["Table1"].RowLayoutStyle = RowLayoutStyle.ColumnLayout; // Prevent the user from resizing the cells/labels. this.ultraGrid1.DisplayLayout.Bands["Table1"].Override.AllowRowLayoutCellSizing = RowLayoutSizing.None; this.ultraGrid1.DisplayLayout.Bands["Table1"].Override.AllowRowLayoutLabelSizing = RowLayoutSizing.None; // Setup Col1 column. gridColumns["Col1"].RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative; gridColumns["Col1"].RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative; // Setup Col2 column. gridColumns["Col2"].RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative; gridColumns["Col2"].RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative; gridColumns["Col2"].RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder; // Setup Col3 column. gridColumns["Col3"].RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative; gridColumns["Col3"].RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative; // Setup Col4 column. gridColumns["Col4"].RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative; gridColumns["Col4"].RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative; gridColumns["Col4"].RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder; // Setup Col5 column. gridColumns["Col5"].RowLayoutColumnInfo.OriginX = RowLayoutColumnInfo.Relative; gridColumns["Col5"].RowLayoutColumnInfo.OriginY = RowLayoutColumnInfo.Relative; gridColumns["Col5"].RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder; }