Does anyone know of a simple way to calculate the height of a row in a listbox? I'm trying to get my listbox to resize depending on the number of items in it, so that it's always exactly the right height.
Ta...
Printable View
Does anyone know of a simple way to calculate the height of a row in a listbox? I'm trying to get my listbox to resize depending on the number of items in it, so that it's always exactly the right height.
Ta...
mark one, take a screenshot and measure it in paint?
VB Code:
Option Explicit Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) _ As Long Private Const LB_GETITEMHEIGHT = &H1A1 Private Sub Command1_Click() Dim lHeight As Long lHeight = SendMessageLong(List1.hwnd, LB_GETITEMHEIGHT, 0&, 0&) MsgBox lHeight & " pixels in height" End Sub Private Sub Form_Load() List1.AddItem "Test" End Sub
My method's less icky :afrog:
What happens when he changes fonts? Then another screenshot needs to be taken and all that.Quote:
Originally posted by vbNeo
My method's less icky :afrog:
Poo on you.
Poo isn't icky :)Quote:
Originally posted by crptcblade
Poo on you.