BBC BASIC for Windows
Programming >> User Interface >> More than one colour in a list box
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1436986813
More than one colour in a list box
Post by JB91 on Jul 15th, 2015, 7:00pm
The wiki article, http://bb4w.wikispaces.com/Changing+a+control%27s+colours, shows how to change the colour of an entire string of text in a dialogue box control.
I want only a portion of the text to be coloured rather than the entire text, something like this:
http://stackoverflow.com/questions/24818827/wpf-listbox-with-different-colors
How can I do this?
Re: More than one colour in a list box
Post by rtr2 on Jul 15th, 2015, 8:37pm
on Jul 15th, 2015, 7:00pm, JB91 wrote:
The only way in the case of a native (Win32) Windows listbox is to make it owner-drawn:
https://social.msdn.microsoft.com/forums/vstudio/en-US/d21617c0-186d-4cfc-bee0-4cef70d1c3ea/individually-colored-list-box-items
https://social.msdn.microsoft.com/Forums/en-US/36bad316-84fc-44ef-bbbe-69304ba3ca3d/add-items-in-listbox-with-different-colors
In BB4W that will require assembler code.
If that's too daunting, use a read-only Rich Edit control instead of a listbox. With care you should be able to make it look and behave the way you want, but in this case it can all be done straightforwardly in BASIC code.
Richard.