バージョン

BeforeRowLayoutItemResized イベント

このイベントは、行レイアウトモードでユーザーが列ヘッダーまたはセルのサイズを変更したときに発生します。
シンタックス
'宣言
 
Public Event BeforeRowLayoutItemResized As BeforeRowLayoutItemResizedEventHandler
public event BeforeRowLayoutItemResizedEventHandler BeforeRowLayoutItemResized
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、BeforeRowLayoutItemResizedEventArgs 型の引数を受け取りました。次の BeforeRowLayoutItemResizedEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
Cancel System.ComponentModel.CancelEventArgsから継承されます。 
NewSize レイアウト項目の変更後のサイズを取得または設定します。
NewSpan レイアウト項目の変更後のスパンを取得または設定します。
OldSize レイアウト項目の変更前のサイズを取得します。
OldSpan レイアウト項目の変更前のスパンを取得します。
ResizeType 実行するサイズ変更操作のタイプを取得します。
RowLayoutItem サイズ変更される行レイアウト項目。これは、UltraGridColumnかColumnHeaderのどちらかになります。サイズ変更される項目がセルの場合は、UltraGridColumnです。サイズ変更される項目がヘッダーの場合は、ColumnHeaderです。
解説

BeforeRowLayoutItemResized は、行レイアウト モードでユーザーが列ヘッダーまたはセルのサイズを変更したときに発生します。このイベントは、サイズ変更される項目に新しい幅または高さが適用される前に発生します。このイベントは、ユーザーが項目のサイズ変更をキャンセルするか、または変更後の新しいサイズをさらに変更する機会を提供します。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_BeforeRowLayoutItemResized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowLayoutItemResizedEventArgs) Handles UltraGrid1.BeforeRowLayoutItemResized
        Debug.Write("BeforeRowLayoutItemResized: ")

        If TypeOf e.RowLayoutItem Is UltraGridColumn Then
            ' If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
            ' with that column are being resized.
            Dim column As UltraGridColumn = DirectCast(e.RowLayoutItem, UltraGridColumn)

            Debug.Write("Cell in row-layout resized. Column = " & column.Header.Caption)
        Else
            ' If the RowLayoutItem is an instance of HeaderBase, then column header (also 
            ' referred to as column label) is being resized.
            Dim header As HeaderBase = DirectCast(e.RowLayoutItem, HeaderBase)

            Debug.Write("Header in row-layout resized. Header = " & header.Caption)
        End If

        Debug.WriteLine(" Old Size = " & e.OldSize.ToString() & " New Size = " & e.NewSize.ToString())

        ' You can conditionally cancel the resize operation by setting Cancel to true.
        If e.OldSize.Height <> e.NewSize.Height Then
            e.Cancel = True
        ElseIf (e.NewSize.Width > 200) Then
            ' You can also set the NewSize to impose constraints on how the item can be resized.
            ' In this case we will prevent the user from resizing items greater than 200.
            e.NewSize = New Size(200, e.NewSize.Height)
        End If
    End Sub

    Private Sub UltraGrid1_AfterRowLayoutItemResized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs) Handles UltraGrid1.AfterRowLayoutItemResized
        Debug.Write("AfterRowLayoutItemResized: ")

        If TypeOf e.RowLayoutItem Is UltraGridColumn Then
            ' If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
            ' with that column are being resized.
            Dim column As UltraGridColumn = DirectCast(e.RowLayoutItem, UltraGridColumn)

            Debug.Write("Cell in row-layout resized. Column = " & column.Header.Caption)
        Else
            ' If the RowLayoutItem is an instance of HeaderBase, then column header (also 
            ' referred to as column label) is being resized.
            Dim header As HeaderBase = DirectCast(e.RowLayoutItem, HeaderBase)

            Debug.Write("Header in row-layout resized. Header = " & header.Caption)
        End If

        Debug.WriteLine(" New Size = " & e.RowLayoutItem.PreferredSize.ToString())
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_BeforeRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.BeforeRowLayoutItemResizedEventArgs e)
		{
			Debug.Write( "BeforeRowLayoutItemResized: " );

			if ( e.RowLayoutItem is UltraGridColumn )
			{
				// If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
				// with that column are being resized.
				UltraGridColumn column = (UltraGridColumn)e.RowLayoutItem;

				Debug.Write( "Cell in row-layout resized. Column = " + column.Header.Caption );
			}
			else
			{
				// If the RowLayoutItem is an instance of HeaderBase, then column header (also 
				// referred to as column label) is being resized.
				HeaderBase header = (HeaderBase)e.RowLayoutItem;

				Debug.Write( "Header in row-layout resized. Header = " + header.Caption );
			}

			Debug.WriteLine( " Old Size = " + e.OldSize.ToString( ) + " New Size = " + e.NewSize );

			// You can conditionally cancel the resize operation by setting Cancel to true.
			if ( e.OldSize.Height != e.NewSize.Height )
			{
				e.Cancel = true;
			}
			// You can also set the NewSize to impose constraints on how the item can be resized.
			// In this case we will prevent the user from resizing items greater than 200.
			else if ( e.NewSize.Width > 200 )
			{
				e.NewSize = new Size( 200, e.NewSize.Height );
			}
		}

		private void ultraGrid1_AfterRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs e)
		{
			Debug.Write( "AfterRowLayoutItemResized: " );

			if ( e.RowLayoutItem is UltraGridColumn )
			{
				// If the RowLayoutItem is an instance of UltraGridColumn, then cells associated
				// with that column are being resized.
				UltraGridColumn column = (UltraGridColumn)e.RowLayoutItem;

				Debug.Write( "Cell in row-layout resized. Column = " + column.Header.Caption );
			}
			else
			{
				// If the RowLayoutItem is an instance of HeaderBase, then column header (also 
				// referred to as column label) is being resized.
				HeaderBase header = (HeaderBase)e.RowLayoutItem;

				Debug.Write( "Header in row-layout resized. Header = " + header.Caption );
			}

			Debug.WriteLine( " New Size = " + e.RowLayoutItem.PreferredSize.ToString( ) );
		}
参照