UG Guru Posted May 25, 2006 Posted May 25, 2006 I'm using a listbox to display status of a program that is running. After an event I add a line of information to the listbox. I'd like to make this a little bit easier to pick out specific information so I'd like to make some areas of text bold or possibly a different colour. I'd even like to go as far as making a section of text in one of the lines in the listbox a different colour/bold to the rest of that line. For example Host123 on network Failed or Installation of Myprog on Host123 Completed Succesfully I've seen a complicated solution that draws the listbox with some extra code but I was expecting there to be a simple way of formatting a strings colour, font etc a bit like html tags. Any help would be great. Cheers, UG Guru Quote
Administrators PlausiblyDamp Posted May 25, 2006 Administrators Posted May 25, 2006 A standard listbox doesn't provide this capability - the only solution would be to ownerdraw the control yourself. You may find that using a RichTextBox control instead might be an easierway to solve the problem though. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Leaders snarfblam Posted May 25, 2006 Leaders Posted May 25, 2006 Another option is the ListView control. In "details" view it looks very similar to a ListBox, but allows you to specify fonts and fore/backcolors. The downside is that it takes a little more work to code and it can't contain any type of object except ListViewItem objects (but you could assign their .Tag property to point to the object that they represent if it helps). Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.