Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

Image Property, CellBaseClass Class

Defines the image of the first ImagePartClass object found in the cell's parts collection.

Class: CellBaseClass
Namespace: Softelvdm.Controls
Assembly: Softelvdm.SftTreeNET

Syntax

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

Value

The image of the first ImagePartClass object.

The default value is null/Nothing.

Comments

Defines the image of the first ImagePartClass object found in the cell's parts collection.

If an application uses only one TextPartClass and one ImagePartClass object in each cell, it can access their contents directly using the CellBaseClass.Text and CellBaseClass.Image properties, instead of having to "remember" which object in the parts collection is the respective object. In addition, the CellBaseClass.TextPart and CellBaseClass.ImagePart properties are available to access these object.

When an image is assigned to the CellBaseClass.Image property, an ImagePartClass object is automatically added to the cell's parts collection, if one has not yet been added.

Examples

C#

        }

        private void ClickCategory(ItemClass item)
        {
            if (item.Level == 0) {
                bool fWasExpanded = item.Expanded;
                if (fWasExpanded) {
                    item.Collapse(CollapseStyleEnum.All);
                    item.Cells[0].Image = m_PlusImage;
                } else {
                    item.Expand(ExpandStyleEnum.All);
                    item.Cells[0].Image = m_MinusImage;
                }
                item.ScrollIntoView();
            } else {
                // selected an item

VB.NET

    item.TagString = "This is a tooltip for an item labeled " & ItemText
End Sub

Private Sub ClickCategory(ByVal item As ItemClass)
    If item.Level = 0 Then
        Dim fWasExpanded As Boolean = item.Expanded
        If fWasExpanded Then
            item.Collapse(CollapseStyleEnum.All)
            item.Cells(0).Image = m_PlusImage
        Else
            item.Expand(ExpandStyleEnum.All)
            item.Cells(0).Image = m_MinusImage
        End If
        item.ScrollIntoView()
    Else
        ' selected an item

See Also CellBaseClass Class | Classes | SftTree/NET 2.0