Sanju
Sanju

Reputation: 213

How to change username color in chat program (VB.NET)?

I am building a chat program which uses a server and a client. Now I have another idea: a user should be able to select his user color and the messages he sends would have his name in that color. I searched all over the web, but couldn't find a solution. How to implement this?

Preview of form design

Upvotes: 2

Views: 326

Answers (1)

Steven Doggart
Steven Doggart

Reputation: 43743

The simplest solution would be to use a RichTextBox rather than a regular TextBox. For more advanced functionality, you could create a custom UserControl which represents a single chat message. The custom control could have a property that allows you to change the color for that message (and user image, and anything else you want to add). You could load any number of them into a FlowLayoutPanel (one per message). Alternatively, you may want to consider using WPF rather than WinForms.

Upvotes: 2

Related Questions