05-21-2012, 04:23 AM
Hi Team Of Programmers,
I need your help of a problem that is frustrating me I have a list view box and I want to change to full row select back colour I have already achieved this for list box but the settings are different this is what I am wanting to do for list view any help will be gratefully taken on board
Code
Kind Regards
Bradley
I need your help of a problem that is frustrating me I have a list view box and I want to change to full row select back colour I have already achieved this for list box but the settings are different this is what I am wanting to do for list view any help will be gratefully taken on board
Code
Code:
Private Sub listBox1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ListBox1.DrawItem
Dim clrSelectedText As Color = Color.Black 'Our color for selected(text)
Dim clrHighlight As Color = Color.LightGreen 'Our background for selected items
If e.State = DrawItemState.Selected Then
'This item is selected
'e.DrawBackground()
e.Graphics.FillRectangle(New SolidBrush(clrHighlight),
e.Bounds) 'Fill the item's rectangle with our highlight
e.Graphics.DrawString(ListBox1.Items.Item(e.Index),
e.Font, New SolidBrush(clrSelectedText), e.Bounds) 'Draw the text for the item
ElseIf e.State = DrawItemState.None Then
'This item has no state
e.DrawBackground() 'Draw our regular background
e.Graphics.DrawString(ListBox1.Items.Item(e.Index),
e.Font, Brushes.Black, e.Bounds) 'Draw the item text in its regular(color)
End If
'Draws a focus rectangle around the item if it has focus
e.DrawFocusRectangle()
End Sub
Kind Regards
Bradley