Hi,
I am trying to save a bmp on the clipboard as a .bmp file. If there is no .bmp on the clipboard, thiscode executes with no error. If I have a bmp file saved on the clipboard, I get an error at the line shown in red.
error code
-2147467259 generic error in GDI+. Not sure what to do next. -Steve
I am trying to save a bmp on the clipboard as a .bmp file. If there is no .bmp on the clipboard, thiscode executes with no error. If I have a bmp file saved on the clipboard, I get an error at the line shown in red.
error code
-2147467259 generic error in GDI+. Not sure what to do next. -Steve
VB.NET:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not System.Windows.Forms.Clipboard.GetDataObject() Is Nothing Then
Dim oDataObj As IDataObject = System.Windows.Forms.Clipboard.GetDataObject()
If oDataObj.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap) Then
Dim oImgObj As System.Drawing.Image = oDataObj.GetData(DataFormats.Bitmap, True)
'To Save as Bitmap
[COLOR="Red"]oImgObj.Save("c:\Test.bmp", System.Drawing.Imaging.ImageFormat.Bmp)[/COLOR]
'To Save as Jpeg
oImgObj.Save("c:\Test.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
'To Save as Gif
oImgObj.Save("c:\Test.gif", System.Drawing.Imaging.ImageFormat.Gif)
End If
End If