xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.Window1"
Title="Using a Path Geometry to Highlight Text"
Background="PowderBlue">
//File:Window.xaml.vb
Imports System
Imports System.Globalization
Imports System.Windows
Imports System.Windows.Media
Namespace WpfApplication1
Public Partial Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Public Sub OnDisplayTextClick(sender As Object, e As EventArgs)
Dim formattedText As New FormattedText("asdf", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, New Typeface("Verdana"), 96, Brushes.Black)
formattedText.SetFontWeight(FontWeights.Bold)
Dim geometry As Geometry = formattedText.BuildGeometry(New Point(0, 0))
Dim pathGeometry As PathGeometry = geometry.GetFlattenedPathGeometry()
path.Data = pathGeometry
matrixAnimation.PathGeometry = pathGeometry
End Sub
End Class
End Namespace