|
-
Nov 14th, 2000, 03:07 AM
#1
Thread Starter
Junior Member
Hi,
Can anyone tell me how to change the colour of a sub item in the VB6 listview control ?
Regards
Phil
-
Nov 14th, 2000, 03:31 AM
#2
Addicted Member
ListItem and ListSubItems
The ListItem itself has a ForeColor property, that will allow you to change the color. Unfortunately, there is no BackColor, so that remains unchanged.
The ListItem also has a collection of ListSubItems. Now unlike SubItems, which kust contains the text of the subitems, the ListSubItems exposes a whole lot of properties for the SubItems. Here you can set the ForeColor of each SubItem.
I hope this helps.
Shrog
http://Shrog.iwarp.com
-
Nov 14th, 2000, 03:57 AM
#3
Addicted Member
Me again,
I just have to add that when you change the ListItem.ForeColor, the change shows automatically in the listview. When you change the ListSubItem.ForeColor, the chnage is not visible until the control refreshes, so you would want to do this after changing the color.
Private Sub Command1_Click()
Dim MyItem As ListItem
Dim MySubItem As ListSubItem
Set MyItem = ListView1.ListItems(lngIndex)
MyItem.ForeColor = vbRed
For Each MySubItem In MyItem.ListSubItems
MySubItem.ForeColor = vbRed
Next MySubItem
ListView1.Refresh
End Sub
-
Nov 14th, 2000, 05:50 AM
#4
Thread Starter
Junior Member
This works fine,
Thanks very much for your help
Best Regards,
Phil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|