2009-07-15 23 views
4

FormattedText文字列をジオメトリベースのオブジェクトに変換するにはどうすればよいですか?FormattedText文字列を幾何学ベースのオブジェクトに変換するにはどうすればよいですか?

私はこの質問には多くの説明を必要とし、私は私が与えることができれば非常に多くの他の細部を考えることはできませんとは思わない...

私は(私は数学的に使用することができます何かにFormattedTextを変換する必要があります幾何学的に)。

アドバイスありがとうございます。

答えて

6

おそらく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)); 

基本的な使用パターンはとても似ています

関連する問題