Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Count Property, ColumnsClass Class

Defines the number of columns.

Class: ColumnsClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public int Count { get; set; }
Public Property Count As Integer

Value

The number of columns.

The default value is 1.

Comments

Defines the number of columns.

The number of columns can be changed anytime, even if tree control is not empty. Any items that have more cells than the defined number of columns, retain these extraneous cell, but they are not displayed. If too few cells are present, the missing cells are considered empty cells.

The ItemCollectionClass.Clear method can be used to remove all items from a tree control.

Additional columns are always added at the end of the column collection. Existing column properties are not changed. Default values are used for the new columns added. These can be changed using the column related properties. The last column will be defined using an explicit column width. If an open-ended column is desired, use the ColumnsClass.LastOpenended property to redefine the last column.

Examples

C#

            // This sample demonstrates drag & drop using one textbox control.
            // To prepare for this sample, create a new project with a blank form and add
            // a SftTree/NET control named sftTree1.
            // In addition, a textbox named textbox1 is needed. Try dragging data from the
            // tree control to the text box.
            // It is also possible to drag files from Windows Explorer to the tree control. 
            // No files are moved/copied, merely their names are added to the tree control.
            sftTree1.Initializing = true;
            sftTree1.Columns.Count = 1;
            for (int i = 0 ; i < 10 ; ++i) {
                ItemClass item = sftTree1.ItemCollection.Add("Item " + i.ToString());
                for (int ic = 0 ; ic < 10 ; ++ic) {
                    ItemClass child = item.Add("Child item " + ic.ToString());
                }
            }
            sftTree1.ItemCollection.Collapse(CollapseStyleEnum.All);

VB.NET

    ' This sample demonstrates drag & drop using one textbox control.
    ' To prepare for this sample, create a new project with a blank form and add
    ' a SftTree/NET control named sftTree1.
    ' In addition, a textbox named textbox1 is needed. Try dragging data from the
    ' tree control to the text box.
    ' It is also possible to drag files from Windows Explorer to the tree control.
    ' No files are moved/copied, merely their names are added to the tree control.
    sftTree1.Initializing = True
    sftTree1.Columns.Count = 1
    For i As Integer = 0 To 9
        Dim item As ItemClass = sftTree1.ItemCollection.Add("Item " & i.ToString())
        For ic As Integer = 0 To 9
            Dim child As ItemClass
            child = item.Add("Child item " & ic.ToString())
        Next
    Next

See Also ColumnsClass Class | Classes | SftTree/NET 2.0