PictureBox正常加载图片文件显示时他会锁定该图片文件。
下面的方法显示就不会锁定图片文件
Dim fs As System.IO.FileStream ' Specify a valid picture file path on your computer. fs = New System.IO.FileStream("C:\WINNT\Web\Wallpaper\Fly Away.jpg", IO.FileMode.Open, IO.FileAccess.Read) PictureBox1.Image = System.Drawing.Image.FromStream(fs) fs.Close()
下面的方法显示图片就会锁定图片文件
PictureBox1.Image = Image.FromFile("C:\WINNT\Web\Wallpaper\Fly Away.jpg")或者
PictureBox1.Load("C:\WINNT\Web\Wallpaper\Fly Away.jpg")