为什么我得到“参数无效”。我尝试保存图片时出现异常?

时间:2016-12-10 12:15:30

标签: vb.net

Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles Savetool.Click
    Using bm As New Bitmap(PictureBox1.Image.Clone, PictureBox1.Width, PictureBox1.Height)
        SaveFileDialog1.FileName = "Picture 1"
        SaveFileDialog1.Filter = "Files|*.jpg;.gif;.bmp"
        If SaveFileDialog1.ShowDialog = DialogResult.OK Then
            bm.Save(SaveFileDialog1.FileName)
            MsgBox("Saved")
            bm.Dispose()
        End If
    End Using
End Sub

当图像很小时,代码可以很好地工作,但是当它变大时会引发异常。

  

参数无效。

0 个答案:

没有答案