From: R.H. on
I was wondering if someone might know if it is possible change the
background color of a listbox so that one line was the default white and
another line was some other color. If not, I guess I will have to use
individual label controls for this. I would rather use a listbox though.

Thanks,
Roger


From: AliR on
You can do that if you set the owner draw flag. It is pretty easy.

take a look these examples:
http://www.codeguru.com/Cpp/controls/listbox/colorlistboxes/article.php/c4745/
http://www.codeguru.com/Cpp/controls/listbox/colorlistboxes/article.php/c1611/

What you would have to do is overwrite the DrawItem and MeasureItem methods,
and do your own drawing in the DrawItem method.

AliR.

"R.H." <roger.hugginsNoSpam(a)intermec.com> wrote in message
news:O3Ssdw4EFHA.2568(a)TK2MSFTNGP10.phx.gbl...
> I was wondering if someone might know if it is possible change the
> background color of a listbox so that one line was the default white and
> another line was some other color. If not, I guess I will have to use
> individual label controls for this. I would rather use a listbox though.
>
> Thanks,
> Roger
>
>


From: Joseph M. Newcomer on
Sure, Use owner-draw. You might want to download my "Logging Listbox Control" from my MVP
Tips site. Now in this one, I do not change the background color, I change the foreground
color, but you can use the same framework to change the background color. Note that I use
an abstract superclass to represent the object, and ask it what color it should show. I
ask the foreground color; you could ask the background color.
joe

On Tue, 15 Feb 2005 10:28:14 -0800, "R.H." <roger.hugginsNoSpam(a)intermec.com> wrote:

>I was wondering if someone might know if it is possible change the
>background color of a listbox so that one line was the default white and
>another line was some other color. If not, I guess I will have to use
>individual label controls for this. I would rather use a listbox though.
>
> Thanks,
> Roger
>

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm