BBC BASIC for Windows
« More than one colour in a list box »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: More than one colour in a list box  (Read 502 times)
JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 47
xx More than one colour in a list box
« Thread started 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?
User IP Logged

rtr2
Guest
xx Re: More than one colour in a list box
« Reply #1 on: Jul 15th, 2015, 8:37pm »

on Jul 15th, 2015, 7:00pm, JB91 wrote:
How can I do this?

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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls