Avatar of sgaggerj
sgaggerjFlag for United States of America asked on

Change individual listviewitem/subitem colors

Hi All,

I am attempting to re-create the color chooser that is in the IDE (the one where you click BackgroundColor and the color chooser pops up with three tabs Custom, Web and System)

I am using a ListView to do the System tab right now.
I have it set to Detail view and have 2 columns.
One column will be the color, and the 2nd column will be the color name.

here's what i've got so far:

With .TabPages(1)
                ' get the colors
                Dim clr() As Color
                Dim ic As ICollection = System.ComponentModel.TypeDescriptor.GetConverter(GetType(Color)).GetStandardValues()
                ReDim clr(ic.Count - 1)
                ic.CopyTo(clr, 0)
                SystemList.Items.Clear()
                For Each c As Color In clr
                    If c.IsSystemColor Then
                        Dim lv1 As New ListViewItem()
                        lv1.BackColor = c
                        ' lv1.subitems(0).backcolor=c ' this doesn't help either.
                        Dim l As New ListViewItem.ListViewSubItem
                        l.Text = c.Name
                        l.BackColor = Color.White
                        l.ForeColor = Color.Black

                        lv1.SubItems.Add(l)

                        SystemList.Columns(0).ListView.Items.Add(lv1)
                    End If
                Next
End With

this works, with one problem.  The entire row is the color 'c', the subitem does not get a background color of White.
(it does when you click on it's corresponding column 0 - it changes to white, but when you click off it gets its original background color)

any suggestions?
Visual Basic.NET

Avatar of undefined
Last Comment
sgaggerj

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
YoungBonzi

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
sgaggerj

WOOOHOOO!

You rock!

thanks!

J
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23