Reputation: 1587
I'm building a program similar to Messenger, sort of a chatting software.
I created a textBox to display the conversation log, and I want to make it look like this:
Nick1: Hi.
Nick2: Hello.
How do I make part of the text bold? I also want to allow users to change their own font, font-color and so on...
Thanks in advance.
Upvotes: 0
Views: 416
Reputation: 3419
Assuming you're using WPF I'd use an ItemsControl to display the conversion. Then for each item I'd have a couple of TextBlocks
one for the user name (which would be bold) and the other for the message.
Hope that helps.
Upvotes: 0
Reputation: 491
The best way is to use a RichTextEdit control, this control can take RTF format codes to easily format the text the way you want it.
eg.
\pard\plain\ltrpar\f0\fs14\sl240\slmult1\b\ Nick1.\par \pard\plain\ltrpar\f0\fs14\sl240\slmult1\Hi
will show up as Nick1 Hi
Upvotes: 0