Прочитать на английском

Поделиться через


TextEffect Конструкторы

Определение

Инициализирует новый экземпляр класса TextEffect.

Перегрузки

TextEffect()

Инициализирует новый экземпляр класса TextEffect.

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

Инициализирует новый экземпляр класса TextEffect, задавая значения его свойств.

TextEffect()

Инициализирует новый экземпляр класса TextEffect.

public TextEffect ();

Примеры

В следующем примере кода показано, как создать TextEffect, задать его свойства и добавить его в TextEffectCollection объект указанного текстового объекта.

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

Применяется к

.NET Framework 4.8.1 и другие версии
Продукт Версии
.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

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

Инициализирует новый экземпляр класса TextEffect, задавая значения его свойств.

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

Параметры

transform
Transform

Объект Transform, применяемый к TextEffect.

foreground
Brush

Объект Brush для применения к содержимому TextEffect.

clip
Geometry

Отсеченная область объекта TextEffect.

positionStart
Int32

Начальная позиции в тексте, к которому применяется TextEffect.

positionCount
Int32

Количество позиций в тексте, к которому применяется TextEffect.

Примеры

В следующем примере кода показано, как вызвать TextEffect конструктор . Обратите внимание, transform что в этом случае для параметров и clip задано значение null, так как эти значения параметров не требуются.

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

Применяется к

.NET Framework 4.8.1 и другие версии
Продукт Версии
.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