TextEffect Constructors

Definition

Initializes a new instance of the TextEffect class.

Overloads

TextEffect()

Initializes a new instance of the TextEffect class.

TextEffect(Transform, Brush, Geometry, Int32, Int32)

Initializes a new instance of the TextEffect class by specifying class property values.

TextEffect()

Initializes a new instance of the TextEffect class.

C#
public TextEffect();

Examples

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

C#
// 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));

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

TextEffect(Transform, Brush, Geometry, Int32, Int32)

Initializes a new instance of the TextEffect class by specifying class property values.

C#
public TextEffect(System.Windows.Media.Transform transform, System.Windows.Media.Brush foreground, System.Windows.Media.Geometry clip, int positionStart, int positionCount);

Parameters

transform
Transform

The Transform that is applied to the TextEffect.

foreground
Brush

The Brush to apply to the content of the TextEffect.

clip
Geometry

The clipping region of the TextEffect.

positionStart
Int32

The starting position in the text that the TextEffect applies to.

positionCount
Int32

The number of positions in the text that the TextEffect applies to.

Examples

The following code example shows how to call the TextEffect constructor. Notice that in this case, the transform and clip parameters are set to null, since those parameters values are not needed.

C#
// Create a new TextEffect object, setting only the foreground brush, position start, and position count.
TextEffect textEffect = new TextEffect(null, solidColorBrush, null, 0, int.MaxValue);

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10