Mega Code Archive

 
Categories / Delphi / Graphic
 

Get bitmaps from the clipboard

Title: Get bitmaps from the clipboard Question: How to paste a bitmap into a delphi app ! Answer: This code shows how to read with TImage or TDBImage easily from the clipboard: uses clipbrd; procedure TForm1.Button1Click(Sender: TObject); begin if Clipboard.HasFormat(CF_BITMAP) then begin Image1.Picture.Assign(Clipboard) // or DBImage1.PasteFromClipboard; end; end; The object 'Clipboard' is automatically created in every delphi application. For the method 'HasFormat' there are the following constants:CF_TEXT, CF_BITMAP, CF_METAFILE (windows-metafile-graphic), CF_PICTURE (ICO, WMF, BMP) and CF_OBJECT (persistent objects).