Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change full row select back colour or list view
#1
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

[Image: untitled.jpg]

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


Messages In This Thread
Change full row select back colour or list view - by Bradley - 05-21-2012, 04:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  View 3D Models in VB .NET Worf 2 12,981 10-14-2014, 04:47 AM
Last Post: Worf
  NullReferenceException when adding item to generic list brco900033 1 9,405 06-17-2014, 12:16 AM
Last Post: brandonio21
  Full screen game overlay? Ecnarf 1 8,119 01-29-2013, 09:14 AM
Last Post: xolara

Forum Jump:


Users browsing this thread: 1 Guest(s)