When I turn on vertical grid lines in a Listbox, it places a grid line at the right of the last column that is also the rightmost edge of the listbox. The left column does not have a similar grid line at the left edge of the listbox. I think this looks silly. I’ve noticed that is I set the column widths using percentages and allow the percentage to exceed 100, then the last grid line disappears. But this seems like a kludge to me and it also will not work when the last column uses an * to specify the width.
Is there another (simple) way to hide the rightmost vertical grid line of a listbox?
Feature Request or Bug Report (depending on how you look at it). I personally think it’s a bug in that the first cell edge and last cell edge are the listbox edges and don’t require a grid line to delineate the edges.
You can always turn them off and do your own in the CellbackgroundPaint event. I’ve found I have a lot more control over everything there, and I really don’t see a performance hit (although when I need a really big grid I use the Einhugur StyleGrid, so maybe I am just not seeing it).
g.ForeColor = &c222222
Select Case column
Case 0, 2, 6
g.PenWidth = 1
g.DrawLine 0, 0, 0, Me.Height
Case 1, 7
g.PenWidth = 2
g.DrawLine 0, 0, 0, Me.Height
End Select
You can use different colored borders, different line thicknesses, etc… I have another grid that I draw a rectangle in the currently selected cell so that it behaves more like Excel, I’ll post in a second. Really easy to implement, the ListBox is pretty flexible.
Basically it’s just reading all listbox the docs, understanding the API and then applying a bit of ingenuity, you can make it do a lot of things with some work.