バージョン

RowLayoutLabelStyle 列挙体

列ラベルをセルと共に配置するか、または行の上の独立した列ヘッダー領域に配置するかを指定する列挙体。
シンタックス
'宣言
 
Public Enum RowLayoutLabelStyle 
   Inherits System.Enum
public enum RowLayoutLabelStyle : System.Enum 
メンバ
メンバ解説
Separate列ラベルが、行の上の独立した領域に配置されます。
WithCellData列ラベルがセルと共に配置され、行ごとに繰り返されます。
使用例
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 random As Random = New Random()
        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")

        ' Get the columns of Table1 band in the UltraGrid.
        Dim gridColumns As ColumnsCollection = band.Columns

        ' Turn on the row layout functionality for Table1 band.
        band.RowLayoutStyle = RowLayoutStyle.ColumnLayout

        ' Set the RowLayoutLabelStyle to WithCellData so the column labels appear
        ' in the row-cell area with cells instead of a seperate area on the top.
        band.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData

        ' Set the RowLayoutLabelPosition to Left so all the cell labels are left
        ' to the cells. LabelPosition can be set on individual columns as well
        ' like we do below to override this default for that column.
        band.RowLayoutLabelPosition = LabelPosition.Left

        ' Setup Col1 column.
        ' --------------------------------------
        gridColumns("Col1").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col1").RowLayoutColumnInfo.OriginY = 0
        ' Allocate 1 horizontal span for the label. Horizontal because the 
        ' RowLayoutLabelPosition is set to Left for the band.
        gridColumns("Col1").RowLayoutColumnInfo.LabelSpan = 1
        ' Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
        gridColumns("Col1").RowLayoutColumnInfo.SpanX = 2
        ' Set the SpanY to 1.
        gridColumns("Col1").RowLayoutColumnInfo.SpanY = 1

        ' Optionally set the minimum and preferred sizes for the cell labels and
        ' the cells associated with Col1.
        gridColumns("Col1").RowLayoutColumnInfo.MinimumCellSize = New Size(50, 20)
        gridColumns("Col1").RowLayoutColumnInfo.MinimumLabelSize = New Size(50, 20)
        gridColumns("Col1").RowLayoutColumnInfo.PreferredCellSize = New Size(100, 20)
        gridColumns("Col1").RowLayoutColumnInfo.PreferredLabelSize = New Size(80, 20)

        ' Allow the user to only resize the label and the cell horizontally and not
        ' vertically.
        gridColumns("Col2").RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal
        gridColumns("Col2").RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal
        ' --------------------------------------

        ' --------------------------------------
        ' Setup Col2 column.
        ' OriginX of the Col2 is 2 because the Col1 occupies the first 2 logical
        ' columns.
        gridColumns("Col2").RowLayoutColumnInfo.OriginX = 2
        gridColumns("Col2").RowLayoutColumnInfo.OriginY = 0
        ' Allocate 1 horizontal span for the label. Horizontal because the 
        ' RowLayoutLabelPosition is set to Left for the band.
        gridColumns("Col2").RowLayoutColumnInfo.LabelSpan = 1
        ' Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
        gridColumns("Col2").RowLayoutColumnInfo.SpanX = 2
        ' Set the SpanY to 1.
        gridColumns("Col2").RowLayoutColumnInfo.SpanY = 1

        ' Optionally set the minimum and preferred sizes for the cell labels and
        ' the cells associated with Col2.
        gridColumns("Col2").RowLayoutColumnInfo.MinimumCellSize = New Size(50, 20)
        gridColumns("Col2").RowLayoutColumnInfo.MinimumLabelSize = New Size(50, 20)
        gridColumns("Col2").RowLayoutColumnInfo.PreferredCellSize = New Size(100, 20)
        gridColumns("Col2").RowLayoutColumnInfo.PreferredLabelSize = New Size(80, 20)

        ' Allow the user to only resize the label and the cell horizontally and not
        ' vertically.
        gridColumns("Col2").RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal
        gridColumns("Col2").RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal
        ' --------------------------------------

        ' --------------------------------------
        ' Setup Col3 column.
        ' Set the OriginX to 0 and OriginY to 1. OriginY of Col1 and Col2 were
        ' set to 0 and their SpanY were 1. In order for Col3 to be below those
        ' columns, OriginY needs to be set to 1.
        gridColumns("Col3").RowLayoutColumnInfo.OriginX = 0
        gridColumns("Col3").RowLayoutColumnInfo.OriginY = 1
        ' For Col3 set the LabelPosition to Top so the cell label is above
        ' the cell.
        gridColumns("Col3").RowLayoutColumnInfo.LabelPosition = LabelPosition.Top
        ' Allocate 1 vertical span for the label. Vertical because the 
        ' RowLayoutLabelPosition is set to Top for the column. 
        gridColumns("Col3").RowLayoutColumnInfo.LabelSpan = 1
        ' Set the SpanX to Remainder so that it spans horizontally to occupy
        ' remaning space.
        gridColumns("Col3").RowLayoutColumnInfo.SpanX = RowLayoutColumnInfo.Remainder
        ' Set the SpanY to 2, 1 for the label and 1 for the cell. (LabelPosition
        ' is set to Top so the label is above the cell.
        gridColumns("Col3").RowLayoutColumnInfo.SpanY = 2

        ' Set the preferred cell height of the Col3 to 40 so it's twice as high as
        ' above cells.
        gridColumns("Col3").RowLayoutColumnInfo.PreferredCellSize = New Size(0, 40)
        ' --------------------------------------

        band.Override.RowSpacingAfter = 5
        band.Override.HeaderAppearance.BackColor = Color.LightBlue
    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.
			Random random = new Random( );
			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"];

			// Get the columns of Table1 band in the UltraGrid.
			ColumnsCollection gridColumns = band.Columns;

			// Turn on the row layout functionality for Table1 band.
			band.RowLayoutStyle = RowLayoutStyle.ColumnLayout;

			// Set the RowLayoutLabelStyle to WithCellData so the column labels appear
			// in the row-cell area with cells instead of a seperate area on the top.
			band.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData;

			// Set the RowLayoutLabelPosition to Left so all the cell labels are left
			// to the cells. LabelPosition can be set on individual columns as well
			// like we do below to override this default for that column.
			band.RowLayoutLabelPosition = LabelPosition.Left;

			// Setup Col1 column.
			// --------------------------------------
			gridColumns["Col1"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col1"].RowLayoutColumnInfo.OriginY = 0;
			// Allocate 1 horizontal span for the label. Horizontal because the 
			// RowLayoutLabelPosition is set to Left for the band.
			gridColumns["Col1"].RowLayoutColumnInfo.LabelSpan = 1;
			// Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
			gridColumns["Col1"].RowLayoutColumnInfo.SpanX	= 2; 
			// Set the SpanY to 1.
			gridColumns["Col1"].RowLayoutColumnInfo.SpanY	= 1;

			// Optionally set the minimum and preferred sizes for the cell labels and
			// the cells associated with Col1.
			gridColumns["Col1"].RowLayoutColumnInfo.MinimumCellSize = new Size( 50, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.MinimumLabelSize = new Size( 50, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.PreferredCellSize = new Size( 100, 20 );
			gridColumns["Col1"].RowLayoutColumnInfo.PreferredLabelSize = new Size( 80, 20);

			// Allow the user to only resize the label and the cell horizontally and not
			// vertically.
			gridColumns["Col2"].RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal;
			gridColumns["Col2"].RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal;
			// --------------------------------------

			// --------------------------------------
			// Setup Col2 column.
			// OriginX of the Col2 is 2 because the Col1 occupies the first 2 logical
			// columns.
			gridColumns["Col2"].RowLayoutColumnInfo.OriginX = 2;
			gridColumns["Col2"].RowLayoutColumnInfo.OriginY = 0;
			// Allocate 1 horizontal span for the label. Horizontal because the 
			// RowLayoutLabelPosition is set to Left for the band.
			gridColumns["Col2"].RowLayoutColumnInfo.LabelSpan = 1;
			// Now set the SpanX to 2. 1 for the Label and 1 for the cell itself.
			gridColumns["Col2"].RowLayoutColumnInfo.SpanX	= 2; 
			// Set the SpanY to 1.
			gridColumns["Col2"].RowLayoutColumnInfo.SpanY	= 1;

			// Optionally set the minimum and preferred sizes for the cell labels and
			// the cells associated with Col2.
			gridColumns["Col2"].RowLayoutColumnInfo.MinimumCellSize = new Size( 50, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.MinimumLabelSize = new Size( 50, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.PreferredCellSize = new Size( 100, 20 );
			gridColumns["Col2"].RowLayoutColumnInfo.PreferredLabelSize = new Size( 80, 20);

			// Allow the user to only resize the label and the cell horizontally and not
			// vertically.
			gridColumns["Col2"].RowLayoutColumnInfo.AllowLabelSizing = RowLayoutSizing.Horizontal;
			gridColumns["Col2"].RowLayoutColumnInfo.AllowCellSizing = RowLayoutSizing.Horizontal;
			// --------------------------------------

			// --------------------------------------
			// Setup Col3 column.
			// Set the OriginX to 0 and OriginY to 1. OriginY of Col1 and Col2 were
			// set to 0 and their SpanY were 1. In order for Col3 to be below those
			// columns, OriginY needs to be set to 1.
			gridColumns["Col3"].RowLayoutColumnInfo.OriginX = 0;
			gridColumns["Col3"].RowLayoutColumnInfo.OriginY = 1;
			// For Col3 set the LabelPosition to Top so the cell label is above
			// the cell.
			gridColumns["Col3"].RowLayoutColumnInfo.LabelPosition = LabelPosition.Top;
			// Allocate 1 vertical span for the label. Vertical because the 
			// RowLayoutLabelPosition is set to Top for the column. 
			gridColumns["Col3"].RowLayoutColumnInfo.LabelSpan = 1;
			// Set the SpanX to Remainder so that it spans horizontally to occupy
			// remaning space.
			gridColumns["Col3"].RowLayoutColumnInfo.SpanX	= RowLayoutColumnInfo.Remainder; 
			// Set the SpanY to 2, 1 for the label and 1 for the cell. (LabelPosition
			// is set to Top so the label is above the cell.
			gridColumns["Col3"].RowLayoutColumnInfo.SpanY	= 2;

			// Set the preferred cell height of the Col3 to 40 so it's twice as high as
			// above cells.
			gridColumns["Col3"].RowLayoutColumnInfo.PreferredCellSize = new Size( 0, 40 );
			// --------------------------------------

			band.Override.RowSpacingAfter = 5;
			band.Override.HeaderAppearance.BackColor = Color.LightBlue;
		}
参照