try
{
this.openFileDialog1.Filter = "BMP 图片 (*.bmp)|*.bmp|JPG 图片 (*.jpg)|*.jpg|GIF 图片 (*.gif)|*.gif|JPEG 图片(*.jpeg)|*.jpeg\" ";
openFileDialog1.Title = "请选择图片";
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
Image image=Image.FromFile(this.openFileDialog1.FileName);
try
{ System.IO.MemoryStream stream = new System.IO.MemoryStream(theData, true);
stream.Write(theData, 0, theData.Length);
Bitmap bmp = new Bitmap(stream);
ViewSearch_Class myclass=new ViewSearch_Class();
int[] b= myclass.ViewPicture(image.Height,image.Width);
pictureBox1.Height=b[0];
pictureBox1.Width=b[1];
pictureBox1.Image=image; }
catch
{}

}
FileStream fs=new FileStream(this.openFileDialog1.FileName,FileMode.OpenOrCreate,FileAccess.Read);
theData=new byte[fs.Length];
fs.Read(theData,0,System.Convert.ToInt32(fs.Length));
fs.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}