我正在开发一个简单的代码来从 filedialog 获取图像,我希望它显示在图片框中。但我收到错误“内存不足”的图像很少。
这是我的代码
Dim srcmap As Bitmap
srcmap = New Bitmap(OpenFileDialog1.FileName)
Dim destbit As New Bitmap(220, 220)
Dim srcRec As New Rectangle(0, 0, srcmap.Width, srcmap.Height)
Dim destRec As New Rectangle(0, 0, 220, 220)
Dim g As Graphics
g = Graphics.FromImage(destbit)
g.DrawImage(srcmap, destRec,srcRec, GraphicsUnit.Pixel)
picturebox.Image = destbit