TextEffect Constructor
.NET Framework 4.5
Initializes a new instance of the TextEffect class.
Assembly: PresentationCore (in PresentationCore.dll)
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. ColorAnimation colorAnimation = 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. SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Black); solidColorBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); // Create a new TextEffect object. Set the foreground to the color-animated brush. TextEffect textEffect = new TextEffect(); textEffect.Foreground = solidColorBrush; // Apply the TextEffect to the entire range of characters. textEffect.PositionStart = 0; textEffect.PositionCount = int.MaxValue; // Create a new text Run, and add the TextEffect to the TextEffectCollection of the Run. Run flickerRun = new Run("Text that flickers..."); flickerRun.TextEffects = new TextEffectCollection(); flickerRun.TextEffects.Add(textEffect); MyFlowDocument.Blocks.Add(new Paragraph(flickerRun));
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.