'宣言 Public Property LabelPosition As NodeLayoutLabelPosition
public NodeLayoutLabelPosition LabelPosition {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.Layout Imports Infragistics.Win.UltraWinTree Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim rootColumnSet As UltraTreeColumnSet = Me.ultraTree1.ColumnSettings.RootColumnSet ' Disallow cell sizing for all columns in the Columns collection rootColumnSet.AllowCellSizing = LayoutSizing.None ' Disallow cell span sizing for all columns in the Columns collection rootColumnSet.AllowCellSpanSizing = GridBagLayoutAllowSpanSizing.None ' Disallow moving for all columns in the Columns collection rootColumnSet.AllowColMoving = GridBagLayoutAllowMoving.None ' Disallow header sizing for all columns in the Columns collection rootColumnSet.AllowLabelSizing = LayoutSizing.None ' Disallow header span sizing for all columns in the Columns collection rootColumnSet.AllowLabelSpanSizing = GridBagLayoutAllowSpanSizing.None ' Disallow sorting for all columns in the Columns collection rootColumnSet.AllowSorting = DefaultableBoolean.False ' Don't display cell borders for any columns in the Columns collection rootColumnSet.BorderStyleCell = UIElementBorderStyle.None ' Don't display header borders for any columns in the Columns collection rootColumnSet.BorderStyleColumnHeader = UIElementBorderStyle.None ' Set the BackColor for all cells in all columns to 'Control' rootColumnSet.CellAppearance.BackColor = SystemColors.Control ' Set CellWrapText to False to prevent text from ' wrapping to additional lines in all columns rootColumnSet.CellWrapText = DefaultableBoolean.False ' Set ColumnAutoSizeMode to 'VisibleNodes' so that when the end ' user auto-sizes a column, only currently visible cells are considered rootColumnSet.ColumnAutoSizeMode = ColumnAutoSizeMode.VisibleNodes ' Set the HeaderStyle property to 'Standard', so that column headers ' are not themed, and set the BackColor of the ColumnHeaderAppearance ' to 'ControlDark'. rootColumnSet.HeaderStyle = HeaderStyle.Standard rootColumnSet.ColumnHeaderAppearance.BackColor = SystemColors.ControlDark ' Change the size of images displayed in the headers to 20w X 20h rootColumnSet.ColumnHeaderImageSize = New Size(20, 20) ' If there is currently no ExpansionIndicatorColumn, set the ' CanShowExpansionIndicator property to true for the ' 'CompanyName' column If rootColumnSet.ExpansionIndicatorColumn Is Nothing Then rootColumnSet.Columns("CompanyName").CanShowExpansionIndicator = DefaultableBoolean.True End If ' Set the LabelPosition property ot display headers on top of cells, ' and set the LabelStyle property to display headers and cells ' separately. rootColumnSet.LabelPosition = NodeLayoutLabelPosition.Top rootColumnSet.LabelStyle = NodeLayoutLabelStyle.Separate ' Assign the 'CompanyName' column to the NodeTextColumn property, ' so that the value of the Text property is obtained from the cell ' in the 'CompanyName' column. rootColumnSet.NodeTextColumn = rootColumnSet.Columns("CompanyName") ' Set the NullText property to "[NULL]" so that null values in any ' cell for all columns is displayed the same way. rootColumnSet.NullText = "[NULL]" ' Show sort indicators for all columns rootColumnSet.ShowSortIndicators = DefaultableBoolean.True End Sub
using Infragistics.Win; using Infragistics.Win.Layout; using Infragistics.Win.UltraWinTree; using System.Diagnostics; private void button1_Click(object sender, System.EventArgs e) { UltraTreeColumnSet rootColumnSet = this.ultraTree1.ColumnSettings.RootColumnSet; // Disallow cell sizing for all columns in the Columns collection rootColumnSet.AllowCellSizing = LayoutSizing.None; // Disallow cell span sizing for all columns in the Columns collection rootColumnSet.AllowCellSpanSizing = GridBagLayoutAllowSpanSizing.None; // Disallow moving for all columns in the Columns collection rootColumnSet.AllowColMoving = GridBagLayoutAllowMoving.None; // Disallow header sizing for all columns in the Columns collection rootColumnSet.AllowLabelSizing = LayoutSizing.None; // Disallow header span sizing for all columns in the Columns collection rootColumnSet.AllowLabelSpanSizing = GridBagLayoutAllowSpanSizing.None; // Disallow sorting for all columns in the Columns collection rootColumnSet.AllowSorting = DefaultableBoolean.False; // Don't display cell borders for any columns in the Columns collection rootColumnSet.BorderStyleCell = UIElementBorderStyle.None; // Don't display header borders for any columns in the Columns collection rootColumnSet.BorderStyleColumnHeader = UIElementBorderStyle.None; // Set the BackColor for all cells in all columns to 'Control' rootColumnSet.CellAppearance.BackColor = SystemColors.Control; // Set CellWrapText to False to prevent text from // wrapping to additional lines in all columns rootColumnSet.CellWrapText = DefaultableBoolean.False; // Set ColumnAutoSizeMode to 'VisibleNodes' so that when the end // user auto-sizes a column, only currently visible cells are considered rootColumnSet.ColumnAutoSizeMode = ColumnAutoSizeMode.VisibleNodes; // Set the HeaderStyle property to 'Standard', so that column headers // are not themed, and set the BackColor of the ColumnHeaderAppearance // to 'ControlDark'. rootColumnSet.HeaderStyle = HeaderStyle.Standard; rootColumnSet.ColumnHeaderAppearance.BackColor = SystemColors.ControlDark; // Change the size of images displayed in the headers to 20w X 20h rootColumnSet.ColumnHeaderImageSize = new Size( 20, 20 ); // If there is currently no ExpansionIndicatorColumn, set the // CanShowExpansionIndicator property to true for the // 'CompanyName' column if ( rootColumnSet.ExpansionIndicatorColumn == null ) rootColumnSet.Columns["CompanyName"].CanShowExpansionIndicator = DefaultableBoolean.True; // Set the LabelPosition property ot display headers on top of cells, // and set the LabelStyle property to display headers and cells // separately. rootColumnSet.LabelPosition = NodeLayoutLabelPosition.Top; rootColumnSet.LabelStyle = NodeLayoutLabelStyle.Separate; // Assign the 'CompanyName' column to the NodeTextColumn property, // so that the value of the Text property is obtained from the cell // in the 'CompanyName' column. rootColumnSet.NodeTextColumn = rootColumnSet.Columns["CompanyName"]; // Set the NullText property to "[NULL]" so that null values in any // cell for all columns is displayed the same way. rootColumnSet.NullText = "[NULL]"; // Show sort indicators for all columns rootColumnSet.ShowSortIndicators = DefaultableBoolean.True; }