Help with ownerdrawn CListBox class
-
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
-
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
I think you can achieve this by handling (reflected) WM_CTLCOLORLISTBOX in CYourListBox. Tomasz Sowinski -- http://www.shooltz.com
-
I think you can achieve this by handling (reflected) WM_CTLCOLORLISTBOX in CYourListBox. Tomasz Sowinski -- http://www.shooltz.com
Thanks Tomasz, that's exactly what I needed. Just swap out the brush in there and it works perfectly... Dave