Copying Graphics to the Clipboard

From RAD Studio
Jump to: navigation, search

Go Up to Using the Clipboard with Graphics


You can copy any picture, including the contents of image controls, to the clipboard. Once on the clipboard, the picture is available to all applications.

To copy a picture to the clipboard, assign the picture to the clipboard object using the Assign method.

This code shows how to copy the picture from an image control named Image to the clipboard in response to a click on an Edit > Copy menu item:

procedure TForm1.Copy1Click(Sender: TObject);
begin
  Clipboard.Assign(Image.Picture)
end.
void __fastcall TForm1::Copy1Click(TObject *Sender)
{
    Clipboard()->Assign(Image->Picture);
}

See Also