WPF 中的自定义文本换行 [英] Custom Text Wrapping in WPF

查看:29
本文介绍了WPF 中的自定义文本换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 WPF 中的非矩形容器中包装文本?

Is there a way of wrapping text in a non-rectangular container in WPF?

这是在 photoshop 中是如何完成的

推荐答案

不幸的是,没有完整的 TextFormatter 实现就没有直接的方法.关于高级 TextFormatter 基础知识的 MSDN 文章:

Unfortunately there isn't a straightforward way without making a complete implementation of a TextFormatter. MSDN article on the basics of an Advanced TextFormatter:

WPF 中的文本布局和 UI 控件提供了格式属性,使您可以轻松地在应用程序中包含带格式的文本.这些控件公开了许多处理文本显示的属性,包括字体、大小和颜色.在一般情况下,这些控件可以处理应用程序中的大部分文本呈现.但是,一些高级场景需要控制文本存储以及文本呈现.WPF 为此提供了一个可扩展的文本格式引擎.

The text layout and UI controls in WPF provide formatting properties that allow you to easily include formatted text in your application. These controls expose a number of properties to handle the presentation of text, which includes its typeface, size, and color. Under ordinary circumstances, these controls can handle the majority of text presentation in your application. However, some advanced scenarios require the control of text storage as well as text presentation. WPF provides an extensible text formatting engine for this purpose.

这篇关于WPF 中的自定义文本换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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