本文主要是介绍WinForm 判断PictureBox中是否有图片,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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中是否有图片的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!