更改 label.text 中的一种 Word 颜色 [英] Changing one Words color in label.text

查看:23
本文介绍了更改 label.text 中的一种 Word 颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 形成 .net 4.0 vb 应用程序.这是一件小事,但我试图改变 label.text 中一个单词的颜色.但它没有发生,我有一种强烈的感觉,让它发生将比它的价值更广泛......我正在尝试使用的片段如下......我只是错过了一个关键细节还是老实说,这更像是一种负担,而不是它的价值.

Windows forms .net 4.0 vb application. This is a small trivial thing but I was trying to just change the color of one word in label.text. But its not happening and I have a strong feeling that to make it happen is going to be more extensive than its worth... A snippet of what I am trying to use is below... Am I just missing a key detail or is this honestly more of a burden than its worth..

    Dim _changeLabel1 As String = " Note Fields Marked in "
    Dim _changeLabel2 As String = " are Required"
    Dim _attrib As New Label
    With _attrib
        .ForeColor = Color.Red
        .Text = "RED"
    End With
    _notificationLabel1.Text = _changeLabel1 + " " + _attrib.Text + " " + _changeLabel2

推荐答案

很遗憾,Winform 标签不支持此功能.

Winform labels don't support this functionality, unfortunately.

您可以改用多个标签,其中一个红色代表您的 RED 文本.

You could use multiple labels instead, with one that's red for your RED text.

这是一个关于此事的相关问题.

这篇关于更改 label.text 中的一种 Word 颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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