I'm trying to paint a different vertical gridline color every 4th column on a DataGridView.
While it works, whenever I scroll horizontally these lines do not persist. I assume that the control doesn't refresh or I am using the wrong event for the custom painting.
Even If I manually do a refresh (let's say through a button), those custom-lines are out of place, so it seems my approach is all wrong from the beginning.
Code:
    Private Sub PatGrid_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles PatGrid.RowPostPaint

        Dim cl As Integer
        Dim gridpen As New Pen(SystemColors.ControlLight)
        Dim colwidths As Integer = PatGrid.RowHeadersWidth

        For cl = 1 To PatGrid.ColumnCount - 1
            colwidths += PatGrid.Columns(cl).Width
            If cl Mod 4 = 0 Then
                e.Graphics.DrawLine(gridpen, colwidths, 0, colwidths, PatGrid.Bottom)
            End If
        Next cl

    End Sub