wpf 中有没有组件可以实现然数据行平滑滚动
动画就能实现
你好 ,能贴下代码吗,我是个新手 , 不太懂
你好 ,能贴下代码吗,我是个新手 , 不太懂
@司徒清风~:
private void Button_Click(object sender, RoutedEventArgs e)
{
//定义简单动画的实例
DoubleAnimation daX = new DoubleAnimation();
DoubleAnimation daY = new DoubleAnimation();
//指定起点
daX.From = 0D;
daY.From = 0D;
//指定终点
Random r = new Random();
daX.To = r.NextDouble() * 300;
daY.To = r.NextDouble() * 300;
//daX.By = 100D;
//daY.By = 100D;
//指定时长300ms
Duration duration=new Duration(TimeSpan.FromMilliseconds(300));
daY.Duration = duration;
daX.Duration = duration;
//将动画添加到偏移变形的实例上面 和Binding的格式有点像
//this.textBox.SetBinding(TextBox.TextProperty,binding)
//让按钮发生改变作为动画
//btn.BeginAnimation(Button.WidthProperty, daX);
//btn.BeginAnimation(Button.HeightProperty, daY);
//让 位置发生改变作为动画
this.tt.BeginAnimation(TranslateTransform.XProperty, daX);
this.tt.BeginAnimation(TranslateTransform.YProperty, daY);
}
http://www.cnblogs.com/lzhp/archive/2012/10/04/2710907.html
@刘宏玺: 谢谢了 效果很好