zl程序教程

您现在的位置是:首页 >  工具

当前栏目

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

动画组件 实现 效果 timer 人物 使用
2023-09-14 08:58:58 时间

实现效果:

  

知识运用:

  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));
        }