'宣言 Public ReadOnly Property CellInsets As Infragistics.Win.Layout.Insets
public Infragistics.Win.Layout.Insets CellInsets {get;}
Imports Infragistics.Win Imports Infragistics.Win.Layout Imports Infragistics.Win.UltraWinTree Private Sub SetLayoutInfo(ByVal column As UltraTreeNodeColumn) Dim layoutInfo As UltraTreeNodeLayoutInfo = column.LayoutInfo ' Disallow cell sizing. layoutInfo.AllowCellSizing = LayoutSizing.None ' Allow horizontal header sizing. layoutInfo.AllowLabelSizing = LayoutSizing.Horizontal ' Use the CellInsets property to add spacing around the cells. layoutInfo.CellInsets.Left = 2 layoutInfo.CellInsets.Top = 2 layoutInfo.CellInsets.Right = 3 layoutInfo.CellInsets.Bottom = 2 ' Use the LabelInsets property to add spacing around the header. layoutInfo.LabelInsets.Left = 1 layoutInfo.LabelInsets.Top = 1 layoutInfo.LabelInsets.Right = 1 layoutInfo.LabelInsets.Bottom = 1 ' Display the header on top of the cells. layoutInfo.LabelPosition = NodeLayoutLabelPosition.Top ' Set the LabelSpan property to 2 so the header spans ' 2 logical units in the virtual grid. layoutInfo.LabelSpan = 2 ' Set the width component of the MinimumCellSize and MinimumLabelSize ' properties to 200 to prevent the cells/header from being made any smaller ' than 200 pixels, and set the height component to 0 so that the minimum ' height is left at the default value. layoutInfo.MinimumCellSize = New Size(200, 0) layoutInfo.MinimumLabelSize = New Size(200, 0) ' Set the OriginX property to the same value as the associated ' column's Index so that the column appears in the user interface ' at the same position as its ordinal position in the collection. layoutInfo.OriginX = layoutInfo.Column.Index ' Set the OriginY property to 'Relative' so that the layout manager ' logic positions this column relative to the preceding column. layoutInfo.OriginY = UltraTreeNodeLayoutInfo.Relative ' Set the width component of the PreferredCellSize and PreferredCellSize ' properties to 200 to make the width 200 pixels, and set the height ' component to 0 so that the height is left at the default value. layoutInfo.PreferredCellSize = New Size(200, 0) layoutInfo.PreferredLabelSize = New Size(200, 0) ' Set the SpanX property to 4 so the column spans ' 2 logical units in the virtual grid. layoutInfo.SpanX = 4 ' Set SpanY to 'Remainder' so that the layout manager ' logic assigns any remaining space to this column layoutInfo.SpanY = UltraTreeNodeLayoutInfo.Remainder ' Set the WeightX and WeightY properties to 0 so that extra ' space is not assigned to this column layoutInfo.WeightX = 0.0F layoutInfo.WeightY = 0.0F End Sub
using Infragistics.Win; using Infragistics.Win.Layout; using Infragistics.Win.UltraWinTree; using System.Diagnostics; private void SetLayoutInfo( UltraTreeNodeColumn column ) { UltraTreeNodeLayoutInfo layoutInfo = column.LayoutInfo; // Disallow cell sizing. layoutInfo.AllowCellSizing = LayoutSizing.None; // Allow horizontal header sizing. layoutInfo.AllowLabelSizing = LayoutSizing.Horizontal; // Use the CellInsets property to add spacing around the cells. layoutInfo.CellInsets.Left = 2; layoutInfo.CellInsets.Top = 2; layoutInfo.CellInsets.Right = 3; layoutInfo.CellInsets.Bottom = 2; // Use the LabelInsets property to add spacing around the header. layoutInfo.LabelInsets.Left = 1; layoutInfo.LabelInsets.Top = 1; layoutInfo.LabelInsets.Right = 1; layoutInfo.LabelInsets.Bottom = 1; // Display the header on top of the cells. layoutInfo.LabelPosition = NodeLayoutLabelPosition.Top; // Set the LabelSpan property to 2 so the header spans // 2 logical units in the virtual grid. layoutInfo.LabelSpan = 2; // Set the width component of the MinimumCellSize and MinimumLabelSize // properties to 200 to prevent the cells/header from being made any smaller // than 200 pixels, and set the height component to 0 so that the minimum // height is left at the default value. layoutInfo.MinimumCellSize = new Size( 200, 0 ); layoutInfo.MinimumLabelSize = new Size( 200, 0 ); // Set the OriginX property to the same value as the associated // column's Index so that the column appears in the user interface // at the same position as its ordinal position in the collection. layoutInfo.OriginX = layoutInfo.Column.Index; // Set the OriginY property to 'Relative' so that the layout manager // logic positions this column relative to the preceding column. layoutInfo.OriginY = UltraTreeNodeLayoutInfo.Relative; // Set the width component of the PreferredCellSize and PreferredCellSize // properties to 200 to make the width 200 pixels, and set the height // component to 0 so that the height is left at the default value. layoutInfo.PreferredCellSize = new Size( 200, 0 ); layoutInfo.PreferredLabelSize = new Size( 200, 0 ); // Set the SpanX property to 4 so the column spans // 2 logical units in the virtual grid. layoutInfo.SpanX = 4; // Set SpanY to 'Remainder' so that the layout manager // logic assigns any remaining space to this column layoutInfo.SpanY = UltraTreeNodeLayoutInfo.Remainder; // Set the WeightX and WeightY properties to 0 so that extra // space is not assigned to this column layoutInfo.WeightX = 0f; layoutInfo.WeightY = 0f; }