二十六、实战图片框,计时器1、新建Windows窗体应用程序,取名ChangeBackground。2、拖放PictureBox、ImageList、Timer三个控件到窗体上,设置如下属性:控件 属性 值PictureBox Name picBackground Dock Fill SizeMode StretchImageImageList Name imlBackground ColorDepth Depth16Bit ImageSize 255,255Timer Name Timer1 Enabled True Interval 10003、双击Timer控件的Tick事件,输入下面代码。if (index < imageList1.Images.Count - 1) { index++; } else { index = 0; } picBackground.Image = imageList1.Images[index];5、 在Form1类中定义全局变量int index = 0;6、 运行这个更换背景程序吧。

评论