namespace _9.图片的上一张和下一张
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\1.jpg");
}
//获得图片文件夹的全路径
string[] path=Directory.GetFiles(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic");
int i=0;
private void btnDownPic_Click(object sender, EventArgs e)
{
i++;
if (i == path.Length)
{
i = 0;
}
pictureBox1.Image = Image.FromFile(path[i]);
}
private void btnUpPic_Click(object sender, EventArgs e)
{
i--;
if (i < 0)
{
i = path.Length - 1;
}
pictureBox1.Image = Image.FromFile(path[i]);
}
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。