Smooth text animation (Marquee) using WPF

℡╲_俬逩灬. 提交于 2019-11-27 08:46:54

Hope this may help you - http://jobijoy.blogspot.com/2008/08/silverlight-marquee-control.html

And the WPF version also can be found here

Your animation will be handled entirely at the MilCore layer if:

  1. Your TranslateTransform is a RenderTransform (not a LayoutTransform), and
  2. You use a simple animation such as a DoubleAnimation, and
  3. Your object has no clipping or opacity calculations

Try using a DoubleAnimation-animated TranslateTransform for a RenderTransform on a TextBlock that is a direct child of a Window with default settings.

  • If this is still slow, there is something slow about your Direct3D system because managed code is not involved at all and MilCore's calls are very simple, but

  • If it works smoothly and efficiently, incrementally change it to your poorly-performing code to see what change causes the slowdown.

Given your response to Jobi Joy's answer I would suspect the problem is somewhere in your hardware or Direct3D setup, but the only way to find out is to test it.

Jeremiah Morrill

If you are using WPF 4.0, try setting the CacheMode="BitmapCache" (in the XAML) on the element you are animating, in this case, probably a TextBlock.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!