ImageMan ActiveX
Using the Clipboard

The image control supports both copying images to the clipboard and pasting images from the clipboard into the control.

 

Copying an image from the control to the clipboard requires invoking the %ImageCopy:IMACTX8~ImageControl~ImageCopy% or %ImageCut:IMACTX8~ImageControl~ImageCut% methods. These methods will copy the image to the clipboard in either vbCFDIB or vbCFMETAFILE formats depending on whether it's a raster or vector image. The following code loads an image into the image control then copies it to the clipboard:

 

ImageControl1.Picture = "c:\sample.pcx"

ImageControl1. ImageCopy

 

To paste an image into the control requires that the Clipboard contains an image in either vbCFDIB or vbCFMETAFILE formats. Invoking the ImagePaste method will paste an image into the Image control. The following code checks for an image of the appropriate type and if it exists, pastes it into the image control.

 

If Clipboard.GetFormat(vbCFDIB) or _

Clipboard.GetFormat(vbCFMETAFILE) Then

ImageControl1.ImagePaste

ImageControl1.Refresh

End If

 

If you can not save an image that has been pasted from the clipboard it may be a vector (WMF) image. If the %ImageFlags:IMACTX8~ImageControl~ImageFlags% property returns a 1 then the Image is a vector image. In which case you will need to convert the image to a raster image before it can be saved.

 

 


© 2014 Data Techniques, Inc. All rights reserved.

Submit feedback on this topic