如何创建连续滚动效果Silverlight 4.0 [英] How to create continuous scrolling effect silverlight 4.0

查看:92
本文介绍了如何创建连续滚动效果Silverlight 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事Silverlight Web应用程序项目

我想为scrollviewer创建连续滚动效果

如果我将鼠标悬停在向左"按钮上,则它会向左滚动,与向右按钮相同,即它向右方向滚动

如果我将鼠标悬停在scrollviewer上,则应停止滚动....

这可能与情节提要动画有关吗????


请大家...
帮助我....

i working on silverlight web application project

i want to create continuous scrolling effect for scrollviewer

where if i mouseover on Left button it scrolls in left direction and same for right button i.e. it scrolls in right direction

if i mouse over on scrollviewer scrolling should be stopped....

is that possible to do with storyboard animation ????


please Guys...
help me out....

推荐答案

Herez滚动效果代码.您可以在适当的事件中申请.

GeneralTransform gt = bg1Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);

点bg1Offset = gt.Transform(new Point(0,0));

Herez the scrolling effect code. You can apply in the appropriate event.

GeneralTransform gt = bg1Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);

Point bg1Offset = gt.Transform(new Point(0, 0));

GeneralTransform gt2 = bg2Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);       
Point bg2Offset = gt2.Transform(new Point(0, 0));

GeneralTransform gt3 = bg3Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);       
Point bg3Offset = gt3.Transform(new Point(0, 0));  

bg1.TranslateX -=  playerVel.X; //bg1 and bg2 are the composite transforms for the canvas 
bg2.TranslateX -=  playerVel.X;
bg3.TranslateX -=  playerVel.X;

if (bg1Offset.X < -bg_width )
    bg1.TranslateX = bg1Offset.X+bg_width; 
      
if (bg2Offset.X < -bg_width )    
    bg2.TranslateX = bg2Offset.X + bg_width;    

if (bg3Offset.X < -bg_width)          
    bg3.TranslateX = bg3Offset.X + bg_width;


这篇关于如何创建连续滚动效果Silverlight 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆