Results 1 to 3 of 3

Thread: change color of listview subitems

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092
    how's that done?
    I have :
    Code:
    Listview.ListItems(3).ForeColor = vbRed
    to change the color of the text in the first column, but how do I change the color of the text in the other columns?

  2. #2

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,092
    anyone, anyone?

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Option Explicit
    
    Private Sub Form_Load()
       Dim i As Integer ' Counter
       Dim j As Integer ' Counter for ListSubItems
       Dim sngWidth As Single
       Dim si As ListSubItem
       Dim li As ListItem
    
       ' You can't see ColumnHeaders or ListSubitems
       ' unless the View is set to lvwReport.
       ListView1.View = lvwReport
    
       ' Calculate the width of a ColumnHeader object.
       sngWidth = ListView1.Width / 5
    
       ' Create five ColumnHeader objects.
       For i = 1 To 5
          ListView1.ColumnHeaders.Add Text:="Col " & i, Width:=sngWidth
       Next i
       
       ' Create twenty ListItem objects. For each ListItem, create four
       ' ListSubItem objects. Set the ForeColor for each object to red.
       For i = 1 To 20
          Set li = ListView1.ListItems.Add(Text:="Item " & i)
          For j = 1 To 4
             Set si = li.ListSubItems.Add(Text:="Subitem " & j)
             li.ForeColor = vbBlue
             si.ForeColor = vbRed
          Next j
       Next i
    End Sub

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width