Nir*_*Nir 32
例如,要创建文本几何体,请使用FormattedText.BuildGeometry来获取字体Tahoma大小的"要显示的文本"的几何图形在点(5,5)处的16像素使用:
FormattedText text = new FormattedText("Text to display",
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface("Tahoma"),
16,
Brushes.Black);
Geometry geometry = text.BuildGeometry(new Point(5, 5));
Run Code Online (Sandbox Code Playgroud)
如果需要在XAML中执行此操作,可以将此代码包装在MarkupExtention中