Results 1 to 3 of 3

Thread: ListViewItem.BackColor; Help Needed

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215

    ListViewItem.BackColor; Help Needed

    Does any body know how to change the backcolor of a ListViewItem and that of a ListViewItem.SubItem.

    The BackColor property does not work.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    Dear Friend, there is a property that can lock a subitem (UseItemStyleForSubItems ). You must set it to a False value:

    Dim Elenco As ListViewItem

    Elenco = Me.LswFatture.Items.Add(Me.StrContatto)
    If Elenco.Index < 3 Then
    Elenco.BackColor = System.Drawing.Color.Red
    End If
    Elenco.UseItemStyleForSubItems = False
    Elenco.SubItems.Add(Me.StrNumDoc)
    Elenco.SubItems.Add(Me.StrData)
    Elenco.SubItems(1).BackColor = System.Drawing.Color.DarkOrange

    In the code above I put a Red color in the first subitem (the first column on the left), for the first 3 rows.
    For any rows, I put a background color = DarkOrange on the second column. The effect is awful, but the example is useful I hope
    Good job
    Live long and prosper (Mr. Spock)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Location
    Lagos, Nigeria
    Posts
    215
    Thanx a lot alextyx.

    It was quit helpful.

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