Column Color Change
-
I want to change the back color of a column in a listview control. I thought I was on the right track by capturing the backgrounderase message and then using this routine
Try If Not Me.mcolSelectedCol.Equals(Nothing) And Not e.Header.Equals(Nothing) And Me.View = View.Details Then If Me.clv1.HeaderHandle.ToInt32 <> 0 Then 'Dim int As Integer = SendMessage(Me.clv1.HeaderHandle, Win32.WindowsMessages.HDM_GETITEMCOUNT, 0, 0) Dim rec As Win32.RECT = Me.arrRects(mintCurColumn) Dim sz As New Size(rec.right - rec.left, rec.bottom - rec.top) Dim g As Graphics = Graphics.FromHdc(e.Msg.WParam) g.FillRectangle(New SolidBrush(Color.Red), rec.left, Top, rec.right - rec.left, Height) End If End If Catch ex As Exception End Try
But no luck as of yet. I have some c# code, but I can't seem to get through all the extra stuff to just pull this code. Any help would be great. TIA -
I want to change the back color of a column in a listview control. I thought I was on the right track by capturing the backgrounderase message and then using this routine
Try If Not Me.mcolSelectedCol.Equals(Nothing) And Not e.Header.Equals(Nothing) And Me.View = View.Details Then If Me.clv1.HeaderHandle.ToInt32 <> 0 Then 'Dim int As Integer = SendMessage(Me.clv1.HeaderHandle, Win32.WindowsMessages.HDM_GETITEMCOUNT, 0, 0) Dim rec As Win32.RECT = Me.arrRects(mintCurColumn) Dim sz As New Size(rec.right - rec.left, rec.bottom - rec.top) Dim g As Graphics = Graphics.FromHdc(e.Msg.WParam) g.FillRectangle(New SolidBrush(Color.Red), rec.left, Top, rec.right - rec.left, Height) End If End If Catch ex As Exception End Try
But no luck as of yet. I have some c# code, but I can't seem to get through all the extra stuff to just pull this code. Any help would be great. TIA