每个字符的WPF TextBlock颜色 [英] WPF TextBlock Color for each Character
本文介绍了每个字符的WPF TextBlock颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在wpf中获取不同颜色的文本块的每个字符?
how to get each character of a textblock of different color in wpf?
推荐答案
使用许多不同的 运行 :
Use many different runs:
<TextBlock FontSize="22">
<Run Foreground="Gold">H</Run>
<Run Foreground="Maroon">e</Run>
<Run Foreground="Blue">l</Run>
<Run Foreground="Orange">l</Run>
<Run Foreground="Brown">o</Run>
</TextBlock>
这将产生结果:
This produce the result:
这篇关于每个字符的WPF TextBlock颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文