How can i get the item height in a ListBox?
Printable View
How can i get the item height in a ListBox?
Easy!
Usage: Height = GetHeightOfListItem(Listbox, ListIndexCode: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
Example:
Dim lHeight As Long
lHeight = GetHeightOfListItem(List1, 1)
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819