private void ToUpload_Click(object sender, EventArgs e)
{
if (pictureBox2.Image != null) //判断pictureBox中是否有图片
{
progressBar1.Value = 0; //清空进度条
progressBar1.Maximum = 102;
for (int i = 0; i < 100; i++)
{
progressBar1.Value += 1;
percentage.Text = "当前进度:" + progressBar1.Value.ToString() + "%\r\n";
//percentage1.Text("当前进度:" + progressBar1.Value.ToString() + "%\r\n");
Thread.Sleep(50);
}
}
else
{
MessageBox.Show("请先上传文件!", "tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
WinForm 判断PictureBox中是否有图片
最新推荐文章于 2023-09-23 10:19:05 发布