Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Image Property, ItemClass Class

Defines the item image displayed in this item.

Class: ItemClass
Namespace: Softelvdm.SftTreeNET
Assembly: Softelvdm.SftTreeNET

Syntax

public Image Image { get; set; }
Public Property Image As Image

Value

The item image.

Comments

Defines the item image displayed in this item.

An item image is an optional image displayed in the hierarchy area.

Optional default images can be defined using the SftTree.ItemExpandableImage, SftTree.ItemExpandedImage and SftTree.ItemLeafImage properties.

When default item images are defined using the ItemExpandableImage, ItemExpandedImage, ItemLeafImage or when item images are defined using the Image property, the SftTree.ItemImageArea property is automatically updated to reserve sufficient space for any of the images used.

Sample images can be found in the directory C:\Program Files\Softelvdm\SftTree NET 2.0\Images. E.g., FolderClosed1_16.png, FolderOpen1_16.png and Leaf1_16.png contain suitable sample images for the SftTree.ItemExpandableImage, SftTree.ItemExpandedImage and SftTree.ItemLeafImage properties.

Examples

C#

            // a SftTree/NET control named sftTree1.
            // In addition, adjust the following FromFile method to use a (small) bitmap
            // that is located on your system.
            Image img = Bitmap.FromFile("..\\..\\test.gif");

            // Add an item
            ItemClass item = sftTree1.ItemCollection.Add();
            CellClass cell = item.Cells[0];
            item.Image = img;
            cell.Text = "Category 1";
            // Add some sub items
            ItemClass subItem = item.Add();
            RadioButtonPartClass rb = new RadioButtonPartClass(RadioButtonStateEnum.Checked);
            subItem.Cells[0].Parts.Add(rb);
            subItem.Cells[0].Parts.Add(new CheckBoxPartClass());
            subItem.Cells[0].Parts.Add(new TextPartClass("Item 1"));

VB.NET

    ' a SftTree/NET control named sftTree1.
    ' In addition, adjust the following FromFile method to use a (small) bitmap
    ' that is located on your system.
    Dim img As Image = Bitmap.FromFile("..\\..\\test.gif")

    ' Add an item
    Dim item As ItemClass = sftTree1.ItemCollection.Add()
    Dim cell As CellClass = item.Cells(0)
    item.Image = img
    cell.Text = "Category 1"
    ' Add some sub items
    Dim subItem As ItemClass = item.Add()
    Dim rb As RadioButtonPartClass = New RadioButtonPartClass(RadioButtonStateEnum.Checked)
    subItem.Cells(0).Parts.Add(rb)
    subItem.Cells(0).Parts.Add(New CheckBoxPartClass())
    subItem.Cells(0).Parts.Add(New TextPartClass("Item 1"))

See Also ItemClass Class | Classes | SftTree/NET 2.0



Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.