Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何将格式化文本字符串转换为基于几何体的对象?_.net_Wpf_.net 3.5_Geometry_Formatted Text - Fatal编程技术网

.net 如何将格式化文本字符串转换为基于几何体的对象?

.net 如何将格式化文本字符串转换为基于几何体的对象?,.net,wpf,.net-3.5,geometry,formatted-text,.net,Wpf,.net 3.5,Geometry,Formatted Text,如何将格式化文本字符串转换为基于几何体的对象 我不认为这个问题需要太多的解释,我也不认为我能给出很多其他细节 我只需要将格式化的文本转换成我可以在数学上(几何上)使用的东西 任何建议都将不胜感激 您可能正在寻找或;两个MSDN链接也都有常见的示例 基本使用模式如下所示: // Create sample formatted text. FormattedText formattedText = new FormattedText("Sample", CultureInfo.GetCult

如何将格式化文本字符串转换为基于几何体的对象

我不认为这个问题需要太多的解释,我也不认为我能给出很多其他细节

我只需要将格式化的文本转换成我可以在数学上(几何上)使用的东西


任何建议都将不胜感激

您可能正在寻找或;两个MSDN链接也都有常见的示例

基本使用模式如下所示:

// Create sample formatted text.
FormattedText formattedText = new FormattedText("Sample",
    CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight,
    new Typeface("Verdana"), 16, System.Windows.Media.Brushes.Black);

// Build geometry object that represents the text.
Geometry normalGeometry = formattedText.BuildGeometry(
    new System.Windows.Point(0, 0));

// Build geometry object that represents the highlight bounding box of the text.
Geometry highLightGeometry = formattedText.BuildHighlightGeometry(
    new System.Windows.Point(0, 0));