views:

249

answers:

1

Possible Duplicate:
Custom ListView binding it to a object list

I have a listbox that should display data that contains 2 fields: time and a message. Instead of displaying 1 line of text, I want each item to be displayed as 2 lines - 1st line is the time and the 2nd line is the message, where each line has a different style.

How can I do this? I can bind the object array to the listbox, but how do I style it? Thanks for your answers.

A: 

I'll just formally post an answer earlier left in a comment. You'll need to use the DrawMode property, there's a good example of a DrawItem event handler in the MSDN Library article. You can draw the text any way you like, including drawing two lines of text. Use a large Font or set the ItemHeight property with DrawMode = OwnerDrawVariable to give yourself enough space for two lines.

Hans Passant