Clipboard Image Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Earlier in VB6, the image was copied onto the clipboard from the Image
Processing Program . This image would then be loaded onto the image control
on the VB form using GetData() function.
In VB.NET there is no image control for one and I get a type cast error
while trying to save the contents of the clipboard using GetData() as an image

Any help on this?

VBUser
 
Earlier in VB6, the image was copied onto the clipboard from the Image
Processing Program . This image would then be loaded onto the image control
on the VB form using GetData() function.
In VB.NET there is no image control for one and I get a type cast error
while trying to save the contents of the clipboard using GetData() as an image

For the image, use a PictureBox control. To find out if the clipboard
has a bitmap on it and to pull that bitmap off into the picturebox, use:

Dim data As IDataObject = Clipboard.GetDataObject()

If data.GetDataPresent(DataFormats.Bitmap) Then
Dim img As Image = DirectCast(data.GetData(DataFormats.Bitmap),
Image)
Me.ClientSize = img.Size
PictureBox1.Location = New Point(0, 0)
PictureBox1.Size = img.Size
PictureBox1.Image = img
End If

This is from the "Form_Load" of a quick windows app I did.
 
Back
Top