THis is driving me insane, I already spent 2 hours on this and can't seem to resolve it.

Here is the problem: I have a backgroundimage for my listview in I programmatically (see below) add items to the list. All items have a white or other solid color (i can change the color with item.backgroundcolor property), but I need to see the background IMAGE - not the solid color. I know it can be done, I have seen it, and when I type in test values in design mode that works. What am I doing wrong? Here is the code.

 Call InitializeListView()

    Call add_into_list("item 1", "item1 col1", "abc")
    Call add_into_list("item 2", "item 2 col", "abc")
    Call add_into_list("item 3", "item 3 col", "abc")

Private Sub InitializeListView()

            ' Set the Location, View and Width properties for the  
            ' ListView object. 
            With (myListView)
                 .View = View.Details
                .Width = 600
                .Height = 600
            End With

            ' Each SubItem object requires a column, so add three columns. 
            Me.myListView.Columns.Add("Item", 200, HorizontalAlignment.Left)
            Me.myListView.Columns.Add("Description", 600, HorizontalAlignment.Left)
            Me.myListView.Columns.Add("html", 0, HorizontalAlignment.Right)         'invisible

            Me.myListView.BackgroundImage = My.Resources.ResourceManager.GetObject("12_image")

            'image list so that can plug in for line height
            ImageList1.ImageSize = New System.Drawing.Size(1, 70)
            ImageList1.TransparentColor = System.Drawing.Color.Transparent
            myListView.SmallImageList = ImageList1

        End Sub

        Private Sub add_into_list(a As String, b As String, c As String)

            ' Add a ListItem object to the ListView. 
            Dim entryListItem As ListViewItem = myListView.Items.Add(a)

            entryListItem.ForeColor = System.Drawing.Color.Red
            entryListItem.Font = New System.Drawing.Font _
                ("Cambria", 18, System.Drawing.FontStyle.Bold)

            ' Set UseItemStyleForSubItems property to false to change  
            ' look of subitems.
            entryListItem.UseItemStyleForSubItems = False

            ' Add the expense subitem. 
            Dim expenseItem As ListViewItem.ListViewSubItem = _

            ' Change the expenseItem object's color and font.
            expenseItem.ForeColor = System.Drawing.Color.Blue
            expenseItem.Font = New System.Drawing.Font _
                ("Cambria", 12, System.Drawing.FontStyle.Italic)

             Dim htmlItem As ListViewItem.ListViewSubItem = _
            'htmlItem.BackColor = Color.Transparent

        End Sub

Just to add.... I have searched and googled for hours and reaching a conclusion that regardless of whether you have a background image or simply a backcolor for the listview, whenever you add items/content to the lisview, they will use their own backcolor and obstruct it. Transparent doesn't seem to work...very i doing something wrong??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.