Multi-coloured text in a winform application

G

Guest

I am developing a game server browser winform application. The app will query
selected servers that are hosting a game (e.g. Quake 3), and the server will
send back a string with various info. One of these pieces of info will be a
list of players names.

My problem is, players can colour their names using ^<char>, where <char> is
a number between 0 and 9, or a letter. I am currently using a list view to
display the list of players.

Is it at all possible to have multi coloured text in a list view, or similar
control? I have seen it done in other apps (although none that are written
using the .Net framework - for example All Seeing Eye). In a web page this
would be simple - simply wrap each of the letters in the players name that
are different from the previous letters colour in a <font> tag.

All help much appreciated.

Thanks
Dan
 
D

durstin

RichTextBox supports varying fonts and styles within its contents, and uses
a standard (the rich text format) for describing it. You could implement a
your own custom ListBox that uses RichTextBox. Or, you could even use just
one multi-line richtextbox instead of a listbox.
 
M

mdb

Is it at all possible to have multi coloured text in a list view, or
similar control? I have seen it done in other apps (although none that
are written using the .Net framework - for example All Seeing Eye). In
a web page this would be simple - simply wrap each of the letters in
the players name that are different from the previous letters colour
in a <font> tag.

Take a look at ListViewSubItem.ForeColor, and make sure to set
UseItemStyleForSubItems property on the ListView.

-mdb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top