private void 图片平均ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "JPEG Files (*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|PNG Files (*.png)|*.png|All files (*.*)|*.*"; openFileDialog.RestoreDirectory = true; openFileDialog.Multiselect = true; openFileDialog.FilterIndex = 1; if (openFileDialog.ShowDialog() == DialogResult.OK) { String[] paths = openFileDialog.FileNames;//获取所选文件路径 pictureBox1.Load(paths[0]); pictureBox2.Image = pictureBox1.Image; for (int i = 1; i < paths.Length; i++) { //Thread.Sleep(500); Bitmap bit2 = new Bitmap(paths[i]); pictureBox2.Image = bit2; Bitmap bit1 = new Bitmap(pictureBox1.Image); pictureBox1.Image = GraphicClass.AvgPicture(bit1, bit2, i); } } }