且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WPF 中的自定义文本换行

更新时间:2023-11-14 16:19:58

不幸的是,没有完整的 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.