更改标签上一个单词的颜色 [英] Changing the Colour of one word on a label

查看:87
本文介绍了更改标签上一个单词的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

对于您中的某些人来说,这似乎很简单,但我好奇地制作了一个简单的应用程序,而我想更改标签中的单词.

标签当前为=您要多少现金?"

我想更改很多"的颜色

能否有人指出我的例子.

提前致谢. :)

Hi Guys,

This may seem Simple to some of you but im curious im making a simple application and i want to change a word within a label.

The label Currently stands as = "how much cash do you want?"

I want to change the colour of "Much"

Can some one point me in the direction of show an example please.

Thanks in advance. :)

推荐答案

如果它是Windows Forms应用程序,我不知道使用一个标签来实现的方法.

您可以做的就是拥有三个标签
1.如何"
2.很多" 将ForeColor设置为您想要的任何颜色.
3.您要现金吗?"

您可能想将它们放在面板上或放入用户控件中,以使对齐和移动变得容易.
If it is a Windows Forms application I do not know a way to do that with one label.

What you can do is have three labels
1. "How"
2. " Much" set the ForeColor to whatever you want.
3. " Cash do You Want?"

You might want to put them on a panel or make them into a user control to make alignment and moving easier.


好吧,我知道您是专门询问标签"控件的,但是"richtextbox控件是否更适合执行此操作? HTH.

例如检查以下内容:
http://www.startvbdotnet.com/controls/rtb.aspx [
Ok, I know you are specifically asking about "label" control, but wouldn''t richtextbox control better suited to do this? HTH.

Check this for instance:
http://www.startvbdotnet.com/controls/rtb.aspx[^]


我将并排使用3个标签边.如果您不想走那条路线.这是一个可以帮助您的c#示例.

http://stackoverflow.com/questions/275836/multiple-colors-in-ac-净标签 [ ^ ]
I would use 3 labels contained side by side. If you do not want to go that route. Here is an example in c# that can help you.

http://stackoverflow.com/questions/275836/multiple-colors-in-a-c-net-label[^]


这篇关于更改标签上一个单词的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆