TextEffect.Foreground Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém ou define o Brush a ser aplicado ao conteúdo do TextEffect.
public:
property System::Windows::Media::Brush ^ Foreground { System::Windows::Media::Brush ^ get(); void set(System::Windows::Media::Brush ^ value); };
public System.Windows.Media.Brush Foreground { get; set; }
member this.Foreground : System.Windows.Media.Brush with get, set
Public Property Foreground As Brush
Valor da propriedade
O pincel usado para aplicar ao TextEffect.
Exemplos
O exemplo de código a seguir mostra como criar um animatable Brush e defini-lo como o valor da Foreground propriedade.
// 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));
' 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()
flickerRun.TextEffects.Add(textEffect)
MyFlowDocument.Blocks.Add(New Paragraph(flickerRun))
Comentários
Informações da propriedade de dependência
Campo identificador | ForegroundProperty |
Propriedades de metadados definidas como true |
Nenhum |