If the clipboard contains a bitmapped graphic, you can paste it into any image object, including image controls and the surface of a form.
procedure TForm1.PasteButtonClick(Sender: TObject); var Bitmap: TBitmap; begin if Clipboard.HasFormat(CF_BITMAP) then { is there a bitmap on the Windows clipboard? ) begin Image1.Picture.Bitmap.Assign(Clipboard); end; end;
void __fastcall TForm1::Paste1Click(TObject *Sender) { Graphics::TBitmap *Bitmap; if (Clipboard()->HasFormat(CF_BITMAP)){ Image1->Picture->Bitmap->Assign(Clipboard()); } }
The graphic on the clipboard could come from this application, or it could have been copied from another application, such as Microsoft Paint. You do not need to check the clipboard format in this case because the paste menu should be disabled when the clipboard does not contain a supported format.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|