property Items.VisibleCount as Long

Retrieves the number of visible items.

TypeDescription
Long Counts the visible items.

Use FirstVisibleItem and NextVisibleItem properties to determine the items that fit the client area. Use the IsItemVisible property to check whether an item fits the control's client area. Use the ItemCount property to count the items in the control. Use the ChildCount property to count the child items. The ItemPosition property determines the position of the item in the parent's child collection. The FormatColumn event is fired before displaying a cell, so you can handle the FormatColumn to display anything on the cell at runtime. This way you can display the row position, you can display the value using the currency format, and so on. The FireFormatColumn property allows the control to fire the FormatColumn event for the column. The Position property specifies the position of the column.

If your chart displays a tree or a hierarchy the position of the item must be determined relative to the FirstVisibleItem as shown in the following VB sample:

Private Sub G2antt1_FormatColumn(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, Value As Variant)
    Value = G2antt1.ScrollPos(True) + RelPos(Item)
End Sub

Private Function RelPos(ByVal hVisible As Long) As Long
    With G2antt1.Items
        Dim h As Long, i As Long, n As Long
        i = 0
        n = .VisibleCount + 1
        h = .FirstVisibleItem
        While (i <= n) And h <> 0 And h <> hVisible
            i = i + 1
            h = .NextVisibleItem(h)
        Wend
        RelPos = i
    End With
End Function