Aracılığıyla paylaş


FormattedText.BuildHighlightGeometry Yöntem

Tanım

Biçimlendirilmiş metnin vurgu sınırlayıcı kutusunu temsil eden bir Geometry nesne döndürür.

Aşırı Yüklemeler

BuildHighlightGeometry(Point)

Biçimlendirilmiş metnin vurgu sınırlayıcı kutusunu temsil eden bir Geometry nesne döndürür.

BuildHighlightGeometry(Point, Int32, Int32)

Geometry Biçimlendirilmiş metnin belirtilen alt dizesi için vurgu sınırlayıcı kutusunu temsil eden bir nesne döndürür.

BuildHighlightGeometry(Point)

Biçimlendirilmiş metnin vurgu sınırlayıcı kutusunu temsil eden bir Geometry nesne döndürür.

public:
 System::Windows::Media::Geometry ^ BuildHighlightGeometry(System::Windows::Point origin);
public System.Windows.Media.Geometry BuildHighlightGeometry (System.Windows.Point origin);
member this.BuildHighlightGeometry : System.Windows.Point -> System.Windows.Media.Geometry
Public Function BuildHighlightGeometry (origin As Point) As Geometry

Parametreler

origin
Point

Vurgu bölgesinin kaynağı.

Döndürülenler

Geometry

Geometry Biçimlendirilmiş metnin vurgu sınırlayıcı kutusunu temsil eden nesne.

Örnekler

Aşağıdaki örnekte, bir FormattedText nesnenin nasıl oluşturulacağı ve biçimlendirilmiş metnin geometrilerinin ve sınırlayıcı kutusunun nasıl alınacağı gösterilmektedir.

/// <summary>
/// Create the outline geometry based on the formatted text.
/// </summary>
public void CreateText()
{
    System.Windows.FontStyle fontStyle = FontStyles.Normal;
    FontWeight fontWeight = FontWeights.Medium;

    if (Bold == true) fontWeight = FontWeights.Bold;
    if (Italic == true) fontStyle = FontStyles.Italic;

    // Create the formatted text based on the properties set.
    FormattedText formattedText = new FormattedText(
        Text,
        CultureInfo.GetCultureInfo("en-us"),
        FlowDirection.LeftToRight,
        new Typeface(
            Font,
            fontStyle,
            fontWeight,
            FontStretches.Normal),
        FontSize,
        System.Windows.Media.Brushes.Black // This brush does not matter since we use the geometry of the text. 
        );

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

    // Build the geometry object that represents the text highlight.
    if (Highlight == true)
    {
        _textHighLightGeometry = formattedText.BuildHighlightGeometry(new System.Windows.Point(0, 0));
    }
}
''' <summary>
''' Create the outline geometry based on the formatted text.
''' </summary>
Public Sub CreateText()
    Dim fontStyle As FontStyle = FontStyles.Normal
    Dim fontWeight As FontWeight = FontWeights.Medium

    If Bold = True Then
        fontWeight = FontWeights.Bold
    End If
    If Italic = True Then
        fontStyle = FontStyles.Italic
    End If

    ' Create the formatted text based on the properties set.
    Dim formattedText As New FormattedText(Text, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, New Typeface(Font, fontStyle, fontWeight, FontStretches.Normal), FontSize, Brushes.Black) ' This brush does not matter since we use the geometry of the text.

    ' Build the geometry object that represents the text.
    _textGeometry = formattedText.BuildGeometry(New Point(0, 0))

    ' Build the geometry object that represents the text highlight.
    If Highlight = True Then
        _textHighLightGeometry = formattedText.BuildHighlightGeometry(New Point(0, 0))
    End If
End Sub

Açıklamalar

Sınırlayıcı kutu bölgesi, tarafından originbelirtilen noktadan başlayarak biçimlendirilmiş metin alanının tamamını içerir. Döndürülen Geometry nesne yalnızca vurgulanan metnin sınırlayıcı kutusunu içerir ve işlenmiş metin içermez.

Aşağıdaki örnekte, dönüştürülen metnin vuruşunu ve vurgulamasını değiştirerek görsel efektler oluşturmanın bir yolu gösterilmektedir.

Vuruşa resim fırçası uygulanmış metin Vuruşa ve vurguya uygulanan resim fırçası örneği

Şunlara uygulanır

BuildHighlightGeometry(Point, Int32, Int32)

Geometry Biçimlendirilmiş metnin belirtilen alt dizesi için vurgu sınırlayıcı kutusunu temsil eden bir nesne döndürür.

public:
 System::Windows::Media::Geometry ^ BuildHighlightGeometry(System::Windows::Point origin, int startIndex, int count);
public System.Windows.Media.Geometry BuildHighlightGeometry (System.Windows.Point origin, int startIndex, int count);
member this.BuildHighlightGeometry : System.Windows.Point * int * int -> System.Windows.Media.Geometry
Public Function BuildHighlightGeometry (origin As Point, startIndex As Integer, count As Integer) As Geometry

Parametreler

origin
Point

Vurgu bölgesinin kaynağı.

startIndex
Int32

Vurgu sınırlarının alınması gereken ilk karakterin dizini.

count
Int32

Vurgu sınırlarının içermesi gereken karakter sayısı.

Döndürülenler

Geometry

Geometry Biçimlendirilmiş metin alt dizesinin vurgu sınırlayıcı kutusunu temsil eden nesne.

Açıklamalar

Döndürülen Geometry nesne yalnızca vurgulanan metnin sınırlayıcı kutusunu içerir ve işlenmiş metin içermez.

Şunlara uygulanır