TextEffect Constructor

TextEffect Constructor ()


Initializes a new instance of the TextEffect class.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

Public Sub New

The following code example shows how to create a TextEffect, set its properties, and add it to the TextEffectCollection of the specified text object.

' Create and configure a simple color animation sequence.  Timespan is in 1000ns ticks.
Dim colorAnimation As New ColorAnimation(Colors.Maroon, Colors.White, New Duration(New TimeSpan(1000000)))
colorAnimation.AutoReverse = True
colorAnimation.RepeatBehavior = RepeatBehavior.Forever

' Create a new brush and apply the color animation.
Dim solidColorBrush As New SolidColorBrush(Colors.Black)
solidColorBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation)

' Create a new TextEffect object. Set the foreground to the color-animated brush.
Dim textEffect As New TextEffect()
textEffect.Foreground = solidColorBrush

' Apply the TextEffect to the entire range of characters.
textEffect.PositionStart = 0
textEffect.PositionCount = Integer.MaxValue

' Create a new text Run, and add the TextEffect to the TextEffectCollection of the Run.
Dim flickerRun As New Run("Text that flickers...")
flickerRun.TextEffects = New TextEffectCollection()

MyFlowDocument.Blocks.Add(New Paragraph(flickerRun))

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft