把一楼的哥们东西改一下给你
private readonly List
{
//三张图片的地址
@"e:\1.jpg",
@"e:\2.jpg",
@"e:\3.jpg"
};
public int currIndex=0;//索引值
private void button1_Click(object sender, EventArgs e)
{
if (currIndex >= imageList.Count)
{
currIndex = 0;
}
pictureBox1.Image = Image.FromFile(imageList[currIndex],true);
currIndex += 1;
}
这代码应该直接可以用
给出代码
public partial class Form1 : Form
{
private readonly List
{
@"e:\1.jpg",
@"e:\2.jpg",
@"e:\3.jpg"
};
private int currIndex = 0;
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (currIndex >= imageList.Count)
currIndex = 0;
pictureBox1.Image = Image.FromFile(imageList[currIndex],true);
currIndex += 1;
}
}
使用imagelist 在按钮事件中写
this.pictureBox1.Image = this.imageList1.Images[i];
改变i就可以了 判断如果i最大了就设置为0