在标签框中显示混合字体文本 [英] Displaying mixed font text in a label box

查看:123
本文介绍了在标签框中显示混合字体文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在标签控件中是否有一种显示包含两部分的字符串的方式,其中第一部分为常规文本,第二部分为红色.无论如何,在WPF中可以用2种颜色呈现字符串吗?

Is there a way of displaying a string, that has two parts, in a label control where the first part is regular text and the second part coloured in red. Is there anyway a string could be rendered in 2 colors in WPF?

推荐答案

有一个很棒的WPF控件,它已经为您完成了,并在此提供CodeProject文章:
WPF HTML支持的TextBlock [ http://www.codeproject.com/search.aspx? doctypeid = 1 [ ^ ].

享受,
—SA
There is a wonderful WPF control where exactly this is already done for you and provided here in this CodeProject article:
WPF HTML Supported TextBlock[^].

Use CodeProject search — it can help you in many cases: http://www.codeproject.com/search.aspx?doctypeid=1[^].

Enjoy,
—SA


否,但是您可以使用XAML在标签内容中放置几个​​文本块,并为每个文本块设置字体.
No, but you can use XAML to put several textblocks in the content of your label, and set the font for each.


这篇关于在标签框中显示混合字体文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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