Hide

SftTree/NET 2.0 - Tree Control for Windows Forms

Display
Print

ScrollIntoView Method, ItemClass Class

Vertically scrolls the item into view so it is displayed in the tree control's client area.

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

Syntax

public void ScrollIntoView();
Public Sub ScrollIntoView()

Comments

Vertically scrolls the item into view so it is displayed in the tree control's client area.

The ScrollIntoView method can be used to make an item visible by scrolling it into view (vertically). The user normally scrolls the tree control items vertically using the scroll bar, but if an application wants to insure that an item is visible, this method can be used.

The ItemClass.TopItem property is used to make a specific item the very first item shown in the tree control area.

To make a particular cell visible, the CellClass.ScrollIntoView method can be used.

This method can only be used for items in the item area.

Examples

C#

                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
            }
        }

        void sftTree1_ShowToolTip(object sender, ToolTipEventArgs e) {
            ItemClass item = e.Cell.OwningItem;

VB.NET

        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
    End If
End Sub

Private Sub sftTree1_ItemClick(ByVal sender As Object, ByVal e As Softelvdm.SftTreeNET.ItemClickEventArgs) Handles sftTree1.ItemClick
    If e.MouseEv.Button = Windows.Forms.MouseButtons.Left And e.Area = ItemClickAreaEnum.CellSel Then

See Also ItemClass Class | Classes | SftTree/NET 2.0