如何将用户名更改为不同的颜色? [英] How to change Username to different color?
问题描述
所以我有一个使用服务器和客户端的项目聊天程序。现在我有另一个想法,用户可以选择他们的用户颜色,他发送的消息将以该颜色命名。如何实现?
以下链接显示表单设计预览
http://www.mediafire.com/view/kxds5o2jrk9bed6/ Untitled.jpg
如果它在这里有用,那就是该程序的链接
http://www.mediafire.com/download/a9h6zmsq4djdvbe/Chat.zip [ ^ ]
感谢您的回复!
So I have a chat program for my project which uses server and client. Now that I have another idea where users can select their user color and the messages he sends will have his name in that color. How to implement this?
Following link shows a preview of form design
http://www.mediafire.com/view/kxds5o2jrk9bed6/Untitled.jpg
If it's helpful here is the link to the program
http://www.mediafire.com/download/a9h6zmsq4djdvbe/Chat.zip[^]
Thank you for your reply!
推荐答案
添加相应的显示它时用户名围绕HTML:
例如
Add the appropriate HTML around his username when you display it:
for example
Dim rawUserName As String = "Sanju Mathew"
Dim userName As String = "<span style=""color:red"">" & rawUserName & "</span>"
myLabel.Text = "Hello " & userName & ", and welcome!"
给你:
你好 Sanju Mathew ,欢迎!
这篇关于如何将用户名更改为不同的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!