ImageEn, unit imageenproc

TImageEnProc.CopyToClipboard

TImageEnProc.CopyToClipboard


Declaration

function CopyToClipboard(Source: TIECopyPasteType = iecpAuto): Boolean;


Description

Copies the selected region, image or layer to the clipboard.

Possible values for Source:
Item Effect
iecpAuto ImageEn automatically detects what to copy. If there is a valid selection, it is copied. If not, and a layer (other than the background) is selected, it is copied. If not, and the image is valid it is copied
iecpFullImage If the image is valid, it is copied to the clipboard, then cleared. Otherwise, it fails
iecpSelection If there is a selection in the associated TImageEnView, it is copied to the clipboard then copied from the image. If there is no selection, it fails
iecpLayer If there is a layer selected in the associated TImageEnView, which is not the background layer, it is copied to the clipboard (as an image and a layer) and then removed from the image

Returns true if successful.

Note:
 By default, transparency is NOT supported, when pasting images to other applications. To support transparency, configure ClipboardCopyFormats
 The main reason for unexpected failures are very large images that exceed the available memory
 If the TImageEnProc is attached to a TIEBitmap, TImageEnMView or TImageEnFolderMView then only iecpFullImage is relevant (iecpAuto will have the same effect as iecpFullImage. iecpSelection and iecpLayer will always fail)
 This method supports PdfViewer if Source = iecpAuto


Examples

// General copy to clipboard method
if ImageEnView1.Proc.CopyToClipboard(iecpAuto) = False then
  MessageDlg( 'Unable to copy to the clipboard. There is insufficient memory available for the operation.', mtError, [ mbOK ], 0 );

// Copying of selection to clipboard
ImageEnView1.Proc.CopyToClipboard( iecpSelection );

// Copying of selected layers to clipboard
ImageEnView1.Proc.CopyToClipboard( iecpLayer );

// Copying the whole image to the clipboard
ImageEnView1.Proc.CopyToClipboard( iecpFullImage );

// Copy the selected image in a TImageEnMView to the clipboard
if IEMView1.SelectedImage >= 0 then
  IEMView1.Proc.CopyToClipboard();

// Copy a file to the clipboard
With TImageEnProc.Create( nil ) do
begin
  AttachedIEBitmap.Read( Filename );
  CopyToClipboard();
  Free();
end;


See Also

 CanCutToClipboard
 CutToClipboard
 CanCopyToClipboard
 CanPasteFromClipboard
 PasteFromClipboard
 PointPasteFromClip
 ClipboardCopyFormats