Results 1 to 2 of 2

Thread: ListBox item height

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Location
    Tel-Aviv, Israel
    Posts
    4

    Post

    How can i get the item height in a ListBox?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Easy!

    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const LB_GETITEMHEIGHT = &H1A1
    
    Public Function GetHeightOfListItem(pListbox As ListBox, pListItem As Integer) As Long
        If pListbox.ListCount = 0 Then Exit Function
        GetHeightOfListItem = SendMessage(pListbox.hwnd, LB_GETITEMHEIGHT, pListItem, 0)
    End Function
    Usage: Height = GetHeightOfListItem(Listbox, ListIndex
    Example:

    Dim lHeight As Long

    lHeight = GetHeightOfListItem(List1, 1)


    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width