Results 1 to 7 of 7

Thread: ListBox selected item backcolor

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    ListBox selected item backcolor

    I have refereed the Colored List Box codebank entry by tassa. Using this i face a problem, whenever the listbox looses the focus, the selected item backcolor is changed to white.

    How should i make the listbox to keep the backcolor.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ListBox selected item backcolor

    I haven't checked out that code but the first thing to check is that HideSelection is False.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: ListBox selected item backcolor

    I couldn't find that property in an ListBox

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ListBox selected item backcolor

    Sorry. The ListView has that property and I was thinking that the ListBox did too but it seems not.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: ListBox selected item backcolor

    I'm not too sure about this, but I saw this in the code:
    Code:
    If e.State = (DrawItemState.Selected Or DrawItemState.Focus) Then
    I too can remember using this check always (check for both Selected and Focus), but perhaps it has something to do with the Focus check. I would advice you to remove the Focus check altogether, but I can remember almost certainly that you will then not draw your items when you select them with the mouse. So I'm not really sure what to do, but perhaps it's still relevant.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: ListBox selected item backcolor

    Nope, removing the Focus check is also not working

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    Re: ListBox selected item backcolor

    is there any other way to keep the backcolor of the selected item

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width