使用Timer组件实现人物动画效果

Posted on 2018-12-27 23:56  努力成长静待花开  阅读(419)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  Graphics类的DrawImage方法    //在指定位置 按原始大小绘制指定的Image对象

  public void DrawImage(Image image,Point point)

实现代码:

        private void timer1_Tick(object sender, EventArgs e)
        {
            CreateGraphics().DrawImage(Image.FromFile(
                (index++>8?(index=1):index).ToString()+".bmp"),new Point(0,0));
        }