Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with ownerdrawn CListBox class

Help with ownerdrawn CListBox class

Scheduled Pinned Locked Moved C / C++ / MFC
helpjsonquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave Glick
    wrote on last edited by
    #1

    Hello, I could use a little help with a CListBox class I'm writing. I've been putting all sorts of code in the DrawItem function to make the List Box nice and pretty. Unfortunatly, I can't seem to change the background of the list box unless there are items in it. I.e., I've got three items in a list box that holds 10. The first three items will be my modified background color, but then the rest of the list box which isn't holding any items is just the default white. Another problem, probably related, is that I wanted to make the ListBox display the disabled color even when it contains no items (you'll noticed the default CListBox class gives no indication it's disabled unless there are items in it). Any thoughs/ideas? -Dave

    T 1 Reply Last reply
    0
    • D Dave Glick

      Hello, I could use a little help with a CListBox class I'm writing. I've been putting all sorts of code in the DrawItem function to make the List Box nice and pretty. Unfortunatly, I can't seem to change the background of the list box unless there are items in it. I.e., I've got three items in a list box that holds 10. The first three items will be my modified background color, but then the rest of the list box which isn't holding any items is just the default white. Another problem, probably related, is that I wanted to make the ListBox display the disabled color even when it contains no items (you'll noticed the default CListBox class gives no indication it's disabled unless there are items in it). Any thoughs/ideas? -Dave

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      I think you can achieve this by handling (reflected) WM_CTLCOLORLISTBOX in CYourListBox. Tomasz Sowinski -- http://www.shooltz.com

      D 1 Reply Last reply
      0
      • T Tomasz Sowinski

        I think you can achieve this by handling (reflected) WM_CTLCOLORLISTBOX in CYourListBox. Tomasz Sowinski -- http://www.shooltz.com

        D Offline
        D Offline
        Dave Glick
        wrote on last edited by
        #3

        Thanks Tomasz, that's exactly what I needed. Just swap out the brush in there and it works perfectly... Dave

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups