Share via


TextRun 클래스

정의

단일 속성 집합을 공유하는 문자 시퀀스를 나타냅니다.

public ref class TextRun abstract
public abstract class TextRun
type TextRun = class
Public MustInherit Class TextRun
상속
TextRun
파생

예제

다음 예제에서는 재정의 GetTextRun 메서드 구현 됩니다.

// Retrieve the next formatted text run for the text source.
public override TextRun GetTextRun(int textSourceCharacterIndex)
{
    // Determine whether the text source index is in bounds.
    if (textSourceCharacterIndex < 0)
    {
        throw new ArgumentOutOfRangeException("textSourceCharacterIndex", "Value must be greater than 0.");
    }

    // Determine whether the text source index has exceeded or equaled the text source length.
    if (textSourceCharacterIndex >= _text.Length)
    {
        // Return an end-of-paragraph indicator -- a TextEndOfParagraph object is a special type of text run.
        return new TextEndOfParagraph(1);
    }

    // Create and return a TextCharacters object, which is formatted according to
    // the current layout and rendering properties.
    if (textSourceCharacterIndex < _text.Length)
    {
        // The TextCharacters object is a special type of text run that contains formatted text.
        return new TextCharacters(
           _text,                                       // The text store
           textSourceCharacterIndex,                    // The text store index
           _text.Length - textSourceCharacterIndex,     // The text store length
           new CustomTextRunProperties());              // The layout and rendering properties
    }

    // Return an end-of-paragraph indicator if there is no more text source.
    return new TextEndOfParagraph(1);
}
' Retrieve the next formatted text run for the text source.
Public Overrides Function GetTextRun(ByVal textSourceCharacterIndex As Integer) As TextRun
    ' Determine whether the text source index is in bounds.
    If textSourceCharacterIndex < 0 Then
        Throw New ArgumentOutOfRangeException("textSourceCharacterIndex", "Value must be greater than 0.")
    End If

    ' Determine whether the text source index has exceeded or equaled the text source length.
    If textSourceCharacterIndex >= _text.Length Then
        ' Return an end-of-paragraph indicator -- a TextEndOfParagraph object is a special type of text run.
        Return New TextEndOfParagraph(1)
    End If

    ' Create and return a TextCharacters object, which is formatted according to
    ' the current layout and rendering properties.
    If textSourceCharacterIndex < _text.Length Then
        ' The TextCharacters object is a special type of text run that contains formatted text.
        Return New TextCharacters(_text, textSourceCharacterIndex, _text.Length - textSourceCharacterIndex, New CustomTextRunProperties()) ' The layout and rendering properties -  The text store length -  The text store index -  The text store
    End If

    ' Return an end-of-paragraph indicator if there is no more text source.
    Return New TextEndOfParagraph(1)
End Function

설명

텍스트 실행을 단일 속성 집합을 공유 하는 문자 시퀀스입니다. 글꼴 스타일, 전경 색, 글꼴 패밀리 또는 기타 서식 지정 효과 텍스트 런 나누기와 같은 형식으로 변경 합니다. 다음 예제에서는 텍스트 문자열의 서식을 변경하면 일련의 텍스트가 실행되는 방법을 보여 줍니다. 각 텍스트 실행에는 일반적인 서식 속성 집합이 있습니다.

합니다 TextRun 클래스에서 처리 하는 텍스트 내용의 몇 가지 형식을 나타내는 형식 계층 구조의 루트인 TextFormatter합니다. 각 클래스에서 파생 된 TextRun 텍스트 콘텐츠 고유 형식을 나타냅니다.

클래스 Description
TextRun 계층의 루트입니다. 동일한 문자 속성 집합을 공유 하는 문자 그룹을 정의 합니다.
TextCharacters 고유 실제 서체의 문자 모양 컬렉션을 정의 합니다.
TextEmbeddedObject 텍스트에 고유 엔터티로 수행 되는 측정, 적중 테스트 및 전체가 그리기 콘텐츠 형식을 정의 합니다. 이 콘텐츠 형식의 예에는 텍스트 선 가운데 있는 단추입니다.
TextEndOfLine 줄 바꿈 문자 코드를 정의 합니다.
TextEndOfParagraph 단락 나누기 문자 코드를 정의 합니다. TextEndOfLine에서 파생됩니다.
TextEndOfSegment 세그먼트 나누기 마커를 정의합니다.
TextHidden 보이지 않는 문자 범위를 정의합니다.
TextModifier 수정 범위의 시작을 정의 합니다.

생성자

TextRun()

TextRun 개체의 인스턴스를 만듭니다.

속성

CharacterBufferReference

텍스트 런 문자 버퍼에 대한 참조를 가져옵니다.

Length

텍스트 런의 문자 수를 가져옵니다.

Properties

서체나 배경 브러시와 같이 텍스트 런의 모든 문자가 공유하는 텍스트 속성 집합을 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보