共四张图片,使用C#picturebox每隔五秒钟显示一张,该如何实现?

也可用imagelist实现,但老是出错。。。
2025-04-17 18:42:44
推荐回答(5个)
回答1:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
int temp = 1;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval = 1000;
this.timer1.Enabled = true;
this.pictureBox1.Image = this.imageList1.Images[0];

}

private void timer1_Tick(object sender, EventArgs e)
{
if (temp % 4!=0)
{
this.pictureBox1.Image = this.imageList1.Images[temp++];
}
else
{
temp = 1;
this.pictureBox1.Image = this.imageList1.Images[0];

}

}
}
}
我这个是用到timer,picturebox,imagelist控件。我先把4张图片放到imagelist里面。然后,初始化时,先让picturebox里的图片为imagelist中的第一张。把timer_tick方法写好,就可以了。
希望对你有所帮助。
good luck to you!

回答2:

用 timer ,设置周期是 5 秒。

在 Timer_Tick 事件里, 让 pictureBox 加载对应的一张图片

回答3:

使用timer控件 在事件中写切换图片的代码 然后修改运行的间隔时间

回答4:

timer控件 就是一个秒表外形的。。。

回答5:

你给一个地址,我给你发一个小实例.
Q我:969661314