Link to home
Start Free TrialLog in
Avatar of Honeyman
Honeyman

asked on

ListView RowHeight

Is there a way to change the ListView's rowheight.  So far the only way I've been able to is change the font size.  However I would live to have normal sized fonts with oversize rowheights.   it doesn't appear that ListView have a .rowheight property.    


TIA
Avatar of Ark
Ark
Flag of Russian Federation image

Hi
Add ImageList and ListView on form:


Private Sub Form_Load()
   ListView1.View=lvwReport
   ListView1.ColumnHeaders.Add , , "Name"
   ImageList1.ImageHeight = 30 'Play with this value
   ImageList1.ListImages.Add , , Me.Icon
   Set ListView1.SmallIcons = ImageList1
   For i = 1 To 20
       ListView1.ListItems.Add , , "Item No. " & i
   Next i
End Sub

Regards
Ark
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PS. To avoid free space on the left (for icons) you can add:

Private Sub SetLVRowHeight(lv As ListView, ilDummy As ImageList, ByVal hgt As Long)
   If hgt <= 0 Then Exit Sub
   Set lv.SmallIcons = Nothing
   ilDummy.ListImages.Clear
   ilDummy.ImageHeight = hgt
   ilDummy.ImageWidth = 1 '*************ADDED
   ilDummy.ListImages.Add , , Me.Icon
   Set lv.SmallIcons = ilDummy
End Sub
Avatar of Honeyman
Honeyman

ASKER

Thank you!  exactly what I needed.
Hi,
I think there should be a change:

Instead of:

ilDummy.ImageHeight = hgt

Put:

ilDummy.ImageHeight = hgt/Screen.TwipsPerPixelY

I design my forms in Twips so for me it is applicable