FormattedText文字列をジオメトリベースのオブジェクトに変換するにはどうすればよいですか?
この質問は多くの説明を必要としないと思います、そして私が与えることができる他の多くの詳細があるかどうか私は考えることができません...
FormattedTextを数学的に(幾何学的に)使用できるものに変換する必要があります。
アドバイスをいただければ幸いです。
FormattedText文字列をジオメトリベースのオブジェクトに変換するにはどうすればよいですか?
この質問は多くの説明を必要としないと思います、そして私が与えることができる他の多くの詳細があるかどうか私は考えることができません...
FormattedTextを数学的に(幾何学的に)使用できるものに変換する必要があります。
アドバイスをいただければ幸いです。
あなたはおそらく探しているFormattedText.BuildGeometry Method
かFormattedText.BuildHighlightGeometry Method
; 両方の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));