Zjištění viditelnosti položky v ListBoxu

Procedura:
'Pro korektní běh potřebuje funkci ListBoxVisibleItems

Sub ListBoxEnsureVisible(lst As ListBox, _
   Optional ByVal itemIndex As Long = -1) 

   Dim visibleCount As Long 

   If itemIndex < 0 Then itemIndex = lst.ListIndex 

   visibleCount = ListBoxVisibleItems(lst) 

   If itemIndex < lst.TopIndex Then
      lst.TopIndex = itemIndex 
   ElseIf itemIndex >= lst.TopIndex + visibleCount Then
      lst.TopIndex = itemIndex - visibleCount + 1 
   End If 

End Sub

Zpět

Autor: The Bozena