meyya.aiht
New member
- Joined
- Aug 4, 2012
- Messages
- 3
- Programming Experience
- Beginner
hi,
i am trying to copy a image from my clipboard to a file...
I am using the below code and it works inside a form button click...but when i place this file inside a class file and activate this code after a keyboard print screen event this doesn't work --- System.Windows.Forms.Clipboard.GetDataObject() is empty , but when i open mspaint and paste the image is copied to paint window.
Any help is appreciated
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)
oImgObj.Save("G:\1.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
End If
thanks in advance
i am trying to copy a image from my clipboard to a file...
I am using the below code and it works inside a form button click...but when i place this file inside a class file and activate this code after a keyboard print screen event this doesn't work --- System.Windows.Forms.Clipboard.GetDataObject() is empty , but when i open mspaint and paste the image is copied to paint window.
Any help is appreciated
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)
oImgObj.Save("G:\1.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
End If
thanks in advance