TextEffect.Foreground Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta l'oggetto Brush da applicare al contenuto di 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
Valore della proprietà
Pennello utilizzato da applicare a TextEffect.
Esempio
Nell'esempio di codice seguente viene illustrato come creare una tabella animabile Brush e impostarla come valore della Foreground proprietà.
// 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))
Commenti
Informazioni proprietà di dipendenza
Campo Identificatore | ForegroundProperty |
Proprietà dei metadati impostate su true |
Nessuno |