Použil jsem ve VB 10 (Windows 10) příklad uváděný pro VB5
Private Sub Button1_Click(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
oImgObj.Save("c:\Test.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
'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
End Sub
Build proběhl bez chyby, při Debugging na všech řádcích vlastního uložení (oImgObj.Save…) byla ohlášena chyba
V rozhraní GDI+ došlo k obecné chybě.
Ani explicitní import System.Windows.Forms.Clipboard nepomohl.
Prosím o radu.