PDA

Click to See Complete Forum and Search --> : ListBox item height


Sigal Laniado
Dec 12th, 1999, 05:51 PM
How can i get the item height in a ListBox?

Serge
Dec 12th, 1999, 06:38 PM
Easy!


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
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)