Imports Infragistics.Win
Imports Infragistics.Win.Layout
Imports Infragistics.Win.UltraWinTree
Private Sub ultraTree1_AfterNodeLayoutItemResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.AfterNodeLayoutItemResizeEventArgs) Handles ultraTree1.AfterNodeLayoutItemResize
' Output a message to the debug window describing the resize operation
Dim message As String = String.Empty
If (e.IsCell) Then
message = "Cell '" + e.Cell.Text + "' was successfully resized."
Else
message = "The header of column '" + e.Column.TextResolved + "' was successfully resized."
End If
End Sub
Private Sub ultraTree1_BeforeNodeLayoutItemResize(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.BeforeNodeLayoutItemResizeEventArgs) Handles ultraTree1.BeforeNodeLayoutItemResize
' Disallow cell resizing for non-root level nodes
If Not e.Node Is Nothing AndAlso e.Node.Level > 0 Then
e.Cancel = True
Return
End If
Dim originalSize As Size = Size.Empty
' Determine whether a cell or header was resized
If (e.IsLabel) Then
originalSize = e.Column.LayoutInfo.PreferredLabelSize
Else
originalSize = e.Column.LayoutInfo.PreferredCellSize
End If
' Determine the amount by which the item was resized
Dim delta As Size = New Size(e.NewSize.Width - originalSize.Width, e.NewSize.Height - originalSize.Height)
' Output a message to the debug window describing the resize operation
Dim message As String = String.Empty
If (e.IsCell) Then
message = "Cell '" + e.Cell.Text + "' is being resized by " + delta.Width.ToString() + " units horizontally and " + delta.Height.ToString() + " units vertically."
Else
message = "The header of column '" + e.Column.TextResolved + "' is being resized by " + delta.Width.ToString() + " units horizontally and " + delta.Height.ToString() + " units vertically."
End If
Debug.WriteLine(message)
End Sub