Listview with gridlines and groups

Experts, I am using a listview on my form. I have it set to use gridlines. In design view the gridlines are there. But as the list is populated it creates groups in the listview to sort the items. When the groups are added the gridlines disappear. Is this just the way it works or is there something else i can do to show the gridlines with groups?
BasicfarmerAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
Search around net suggests that its a well known limitation but I have not been able to find any solution.
0
 
BasicfarmerAuthor Commented:
I did not get that it was well know but i have done quite a bit of searching for it and people continue to suggest making sure that gridlines is set to TRUE.
0
 
BasicfarmerAuthor Commented:
I give up. I cannot find anything definitively saying it does not work, but cannot find a solution either.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Robert SchuttSoftware EngineerCommented:
Have you looked into the OwnerDraw property? If you set it to True and hook up some events like this for example
    Private Sub ListView1_DrawSubItem(sender As Object, e As System.Windows.Forms.DrawListViewSubItemEventArgs) Handles ListView1.DrawSubItem
        With e.Graphics
            .DrawLines(New Pen(SystemColors.ButtonFace), New Point() {New Point(e.Bounds.Left, e.Bounds.Top - 1), New Point(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top - 1), New Point(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top + e.Bounds.Height), New Point(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height)})
        End With
        e.DrawText()
    End Sub

    Private Sub ListView1_DrawColumnHeader(sender As Object, e As System.Windows.Forms.DrawListViewColumnHeaderEventArgs) Handles ListView1.DrawColumnHeader
        e.DrawDefault = True
    End Sub

Open in new window

it seems to come close to what you need.
capture
0
 
BasicfarmerAuthor Commented:
Robert, I am sorry that i gave up too soon and already posted points to another member. Thank you for posting this I will follow this lead...
0
 
Robert SchuttSoftware EngineerCommented:
No problem, see if you can get it to work for you and if so, we talk business ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.