Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your vertical jumping problem is due to font rendering rounding. Specifically, WPF will avoid subpixel font height in order to enable font smoothing. One way to avoid this is to convert your text into a path geometry and then use a scale transform to animate it.</p> <p>Here is an alternate version of your example without the jumping. The new XAML is:</p> <pre><code>&lt;Grid&gt; &lt;Path Name="Path" HorizontalAlignment="Center" VerticalAlignment="Center"/&gt; &lt;/Grid&gt; </code></pre> <p>and the new code when you load the window:</p> <pre><code>SetText(""); var transform = new ScaleTransform(1, 1); Path.LayoutTransform = transform; var animationX = new DoubleAnimation(1, 10, new Duration(TimeSpan.FromSeconds(60))); transform.BeginAnimation(ScaleTransform.ScaleXProperty, animationX); var animationY = new DoubleAnimation(1, 10, new Duration(TimeSpan.FromSeconds(60))); transform.BeginAnimation(ScaleTransform.ScaleYProperty, animationY); </code></pre> <p>and a new method to set the text that is anmiated:</p> <pre><code>private void SetText(string text) { var formatted = new FormattedText(text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Lucida Console"), 12, Brushes.Black); Path.Data = formatted.BuildGeometry(new Point(0, 0)); Path.Fill = Brushes.Black; } </code></pre> <p>and you have call SetText from your timer event handler.</p> <p>Note that to avoid horizontal jumpiness, you have to use a fixed-length text string and a constant-width font.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload