News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Mulit-line colored text in listboxes

Started by Ratch, October 09, 2006, 05:03:15 AM

Previous topic - Next topic

Ratch

To the Ineffable All,

     Does anyone know how to make colored text lines in listboxes.  It's a snap to use WM_CTLCOLORLISTBOX, and then change the text color and background.  BUT, that changes ALL the text lines in a listbox to the same color and background.  I am looking to make each line I write to a listbox a different color and background.  Is that possible?  Ratch

PBrennick

Ratch,
Yes, you can do that by putting the listbox control onto a richedit window. It is probablly overkill but I acquired an addressbook application from someon, forgot who.  There were 3 rows of columns per entry so the author decided to change background colors for each entry. I will post it, if you like. The zip is 35,164 bytes.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

japheth


My suggestion is: use a listview with 1 column to emulate the listbox. With the listview, use the CUSTOMDRAW feature.

Tedd

Listbox has OWNERDRAW styles (LBS_OWNERDRAWFIXED, LBS_OWNERDRAWVARIABLE) -- pick one and go from there :wink
I'd go with fixed.
No snowflake in an avalanche feels responsible.

Ratch

To the Ineffable All,

     Listbox with LBS_OWNERDRAWFIXED style works great.  Capture WM_DRAWITEM and use TextOut or DrawItem.  Thanks to all and especially Tedd.  Ratch