内存流例子:
private void pictureBox1_Click(object sender, EventArgs e) { OpenFileDialog op = new OpenFileDialog(); //op.Filter = "JPG图片|*.jpg|PNG图片|*.png"; op.Filter = "(JPG图片,PNG图片,BMP文件)|*.jpg|*.png|*.bmp"; if (op.ShowDialog() == DialogResult.OK) { label1.Text = op.FileName; FileStream fs = new FileStream(op.FileName,FileMode.Open); byte[] data = new byte[fs.Length]; fs.Read(data,0,data.Length); fs.Close(); MemoryStream ms = new MemoryStream(data); pictureBox1.Image = Image.FromStream(ms); } }