OpenFileDialog ofdPic= new OpenFileDialog(); ofdPic.Filter = "JPG(*.JPG;*.JPEG);gif文件(*.GIF)|*.jpg;*.jpeg;*.gif"; ofdPic.FilterIndex = 1; ofdPic.FileName = ""; if (ofdPic.ShowDialog() == DialogResult.OK) { string sPicPaht = ofdPic.FileName.ToString(); Bitmap bmPic = new Bitmap(sPicPaht); Point ptLoction = new Point(bmPic.Size); if (ptLoction.X > mypicbox.Size.Width || ptLoction.Y > mypicbox.Size.Height) { //圖像框的停靠方式 //pcbPic.Dock = DockStyle.Fill; //圖像充滿圖像框,並且圖像維持比例 mypicbox.SizeMode = PictureBoxSizeMode.Zoom; } else { //圖像在圖像框置中 mypicbox.SizeMode = PictureBoxSizeMode.CenterImage; } //LoadAsync:非同步載入圖像 mypicbox.LoadAsync(sPicPaht); }