学习笔记:Silverlight 三种动画 图片截取 循环给二维数组赋值

学习笔记:Silverlight 三种动画 图片截取 循环给二维数组赋值,第1张

概述移动 Storyboard storyboard = new Storyboard();//创建X轴方向动画DoubleAnimation doubleAnimation = new DoubleAnimation(0,100,new Duration(TimeSpan.FromMilliseconds(500)));Storyboard.SetTarget(doubleAnimation,
移动
Storyboard storyboard = new Storyboard();//创建X轴方向动画DoubleAnimation doubleAnimation = new DoubleAnimation(0,100,new Duration(TimeSpan.FromMilliseconds(500)));Storyboard.SetTarget(doubleAnimation,rect);Storyboard.SetTargetProperty(doubleAnimation,new PropertyPath("(Canvas.left)"));storyboard.Children.Add(doubleAnimation);
storyboard.Begin(); 

//注册界面刷新事件Loaded

CompositionTarget.Rendering +=newEventHandler(Timer_Tick);      //匀速

rivatevoID Timer_Tick(object sender,EventArgs e) {            }

 

//定义线程   循环

 dispatcherTimer dispatcherTimer =newdispatcherTimer(dispatcherPriority.normal);

 dispatcherTimer.Tick +=newEventHandler(Timer_Tick);

 dispatcherTimer.Interval =TimeSpan.FromMilliseconds(50);//重复间隔

 dispatcherTimer.Start();

 -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------------------------------

图片截取

image.soruce=new BitmAPImage(new Uri(@"Player\" + count + ".png",UriKind.relative));private BitmapSource cutimage(string imgaddress,int x,int y,int wIDth,int height) {      return new CroppedBitmap(                BitmapFrame.Create(new Uri(imgaddress,UriKind.relative)),new Int32Rect(x,y,wIDth,height)                );}


 

循环给二维数组赋值

privatebyte[,] Matrix = newbyte[1024,1024];

for (int y = 0; y < Matrix.GetUpperBound(1); y++) {

                for (int x = 0; x < Matrix.GetUpperBound(0); x++) {

                    Matrix[x,y] = 1;

                }

  }

 

SL光标

public static Cursor[] GameCursors = new Cursor[4];

        ///<summary>

        ///返回指定标号光标

        ///</summary>

        ///<param name="sign">标号</param>

        ///<returns>光标</returns>

        public static Cursor getCursor(int sign) {

            if (GameCursors[sign] == null) {

                GameCursors[sign] = new Cursor(new fileStream(string.Format(@"Cursors\{0}.ani",sign),fileMode.Open,fileAccess.Read,fileShare.Read));

            }

            return GameCursors[sign];

        }

总结

以上是内存溢出为你收集整理的学习笔记:Silverlight 三种动画 图片截取 循环给二维数组赋值全部内容,希望文章能够帮你解决学习笔记:Silverlight 三种动画 图片截取 循环给二维数组赋值所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1018061.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存