'宣言 Public Property LabelStyle As NodeLayoutLabelStyle
public NodeLayoutLabelStyle LabelStyle {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 columnSettings As UltraTreeColumnSettings = Me.ultraTree1.ColumnSettings ' Disallow cell sizing for all columns in the Columns collection columnSettings.AllowCellSizing = LayoutSizing.None ' Disallow cell span sizing for all columns in the Columns collection columnSettings.AllowCellSpanSizing = GridBagLayoutAllowSpanSizing.None ' Disallow moving for all columns in the Columns collection columnSettings.AllowColMoving = GridBagLayoutAllowMoving.None ' Disallow header sizing for all columns in the Columns collection columnSettings.AllowLabelSizing = LayoutSizing.None ' Disallow header span sizing for all columns in the Columns collection columnSettings.AllowLabelSpanSizing = GridBagLayoutAllowSpanSizing.None ' Disallow sorting for all columns in the Columns collection columnSettings.AllowSorting = DefaultableBoolean.False ' If the ViewStyle is OutlookExpress, set AutoFitColumns to 'ResizeAllColumns'. If Not columnSettings.Control Is Nothing AndAlso columnSettings.Control.ViewStyleResolved = ViewStyle.OutlookExpress Then columnSettings.AutoFitColumns = AutoFitColumns.ResizeAllColumns End If ' Don't display cell borders for any columns in the Columns collection columnSettings.BorderStyleCell = UIElementBorderStyle.None ' Don't display header borders for any columns in the Columns collection columnSettings.BorderStyleColumnHeader = UIElementBorderStyle.None ' Set the BackColor for all cells in all columns to 'Control' columnSettings.CellAppearance.BackColor = SystemColors.Control ' Set CellWrapText to False to prevent text from ' wrapping to additional lines in all columns columnSettings.CellWrapText = DefaultableBoolean.False ' Set ColumnAutoSizeMode to 'VisibleNodes' so that when the end ' user auto-sizes a column, only currently visible cells are considered columnSettings.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'. columnSettings.HeaderStyle = HeaderStyle.Standard columnSettings.ColumnHeaderAppearance.BackColor = SystemColors.ControlDark ' Change the size of images displayed in the headers to 20w X 20h columnSettings.ColumnHeaderImageSize = New Size(20, 20) ' Set the LabelPosition property ot display headers on top of cells, ' and set the LabelStyle property to display headers and cells ' separately. columnSettings.LabelPosition = NodeLayoutLabelPosition.Top columnSettings.LabelStyle = NodeLayoutLabelStyle.Separate ' Assign the control key as the multi-sort extension key columnSettings.MultiSortModifierKey = Keys.Control ' Set the NullText property to "[NULL]" so that null values in any ' cell for all columns is displayed the same way. columnSettings.NullText = "[NULL]" ' Show sort indicators for all columns columnSettings.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) { UltraTreeColumnSettings columnSettings = this.ultraTree1.ColumnSettings; // Disallow cell sizing for all columns in the Columns collection columnSettings.AllowCellSizing = LayoutSizing.None; // Disallow cell span sizing for all columns in the Columns collection columnSettings.AllowCellSpanSizing = GridBagLayoutAllowSpanSizing.None; // Disallow moving for all columns in the Columns collection columnSettings.AllowColMoving = GridBagLayoutAllowMoving.None; // Disallow header sizing for all columns in the Columns collection columnSettings.AllowLabelSizing = LayoutSizing.None; // Disallow header span sizing for all columns in the Columns collection columnSettings.AllowLabelSpanSizing = GridBagLayoutAllowSpanSizing.None; // Disallow sorting for all columns in the Columns collection columnSettings.AllowSorting = DefaultableBoolean.False; // If the ViewStyle is OutlookExpress, set AutoFitColumns to 'ResizeAllColumns'. if ( columnSettings.Control != null && columnSettings.Control.ViewStyleResolved == ViewStyle.OutlookExpress ) columnSettings.AutoFitColumns = AutoFitColumns.ResizeAllColumns; // Don't display cell borders for any columns in the Columns collection columnSettings.BorderStyleCell = UIElementBorderStyle.None; // Don't display header borders for any columns in the Columns collection columnSettings.BorderStyleColumnHeader = UIElementBorderStyle.None; // Set the BackColor for all cells in all columns to 'Control' columnSettings.CellAppearance.BackColor = SystemColors.Control; // Set CellWrapText to False to prevent text from // wrapping to additional lines in all columns columnSettings.CellWrapText = DefaultableBoolean.False; // Set ColumnAutoSizeMode to 'VisibleNodes' so that when the end // user auto-sizes a column, only currently visible cells are considered columnSettings.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'. columnSettings.HeaderStyle = HeaderStyle.Standard; columnSettings.ColumnHeaderAppearance.BackColor = SystemColors.ControlDark; // Change the size of images displayed in the headers to 20w X 20h columnSettings.ColumnHeaderImageSize = new Size( 20, 20 ); // Set the LabelPosition property ot display headers on top of cells, // and set the LabelStyle property to display headers and cells // separately. columnSettings.LabelPosition = NodeLayoutLabelPosition.Top; columnSettings.LabelStyle = NodeLayoutLabelStyle.Separate; // Assign the control key as the multi-sort extension key columnSettings.MultiSortModifierKey = Keys.Control; // Set the NullText property to "[NULL]" so that null values in any // cell for all columns is displayed the same way. columnSettings.NullText = "[NULL]"; // Show sort indicators for all columns columnSettings.ShowSortIndicators = DefaultableBoolean.True; }