views:

162

answers:

2

Hi,

I have an application that works similar to a chat, except beside the location where they submit their message they also have a dropdown that selects the type of message it is.

When someone sends a message the message appears in a listbox (can also be a listview or a multiline textbox if that would work easier for what I want to do). What I need to happen is that the message they submit needs to be color coded based on what message type they chose in the dropdown.

Does anyone know how to make list items be different colors?

Thanks,
Matt

A: 

Look into drawing the items yourself by subscribing to the DrawItem event and drawing each entry yourself. You can use the TextRenderer class to draw strings that don't look like crap (instead of using Graphic's implementation).

More information can also be found here.

nasufara
A: 

If you don't want to draw the items yourself then use a ListView.

You'll need to set it into either a List or Details mode (in Details mode you'll need to add a column). Then you can add items to the list and set the background or foreground colors. See ListViewItem

Matt Breckon