2009-07-15 4 views
4

FormattedText 문자열을 기하학 기반 개체로 변환하려면 어떻게해야합니까?FormattedText String을 도형 기반 객체로 변환하는 방법은 무엇입니까?

난 그냥 내가 수학적으로 사용할 수있는 무언가 (로 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)); 
:

기본 사용 패턴과 같이이다

관련 문제