Vcl.Graphics.TPicture.LoadFromClipboardFormat
Delphi
procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle;
APalette: HPALETTE);
C++
void __fastcall LoadFromClipboardFormat(System::Word AFormat, NativeUInt AData, HPALETTE APalette);
Eigenschaften
Typ | Sichtbarkeit | Quelle | Unit | Übergeordnet |
---|---|---|---|---|
procedure function |
public | Vcl.Graphics.pas Vcl.Graphics.hpp |
Vcl.Graphics | TPicture |
Beschreibung
Liest die Grafik aus dem im angegebenen Zwischenablageformat bereitgestellten Handle.
Mit LoadFromClipboardFormat können Sie eine Grafik aus der Zwischenablage einlesen. Wenn das angegebene Format nicht unterstützt wird, löst LoadFromClipboardFormat eine EInvalidGraphic-Exception aus.
Das folgende Codefragment zeigt, wie ein Bild aus der Zwischenablage in das Steuerelement TImage geladen wird.
- Hinweis: Mit dem Codefragment für die Methode SaveToClipboardFormat können Sie ein Bild in die Zwischenablage laden.
Delphi:
uses
Vcl.Clipbrd;
procedure TForm1.Button1Click(Sender: TObject);
var
Picture: TPicture;
begin
Picture := TPicture.Create;
try
Picture.LoadFromClipboardFormat(cf_BitMap, ClipBoard.GetAsHandle(cf_Bitmap), 0);
Image1.Picture := Picture;
finally
Picture.Free;
Clipboard.Clear;
end;
end;
C++:
#include <Vcl.Clipbrd.hpp>
void __fastcall TForm1::Button1Click(TObject *Sender){
TPicture* Picture;
TClipboard* cb = Clipboard();
Picture = new TPicture();
try{
Picture->LoadFromClipboardFormat(CF_BITMAP, cb->GetAsHandle(CF_BITMAP), 0);
Image1->Picture = Picture;
}
__finally{
delete Picture;
cb->Clear();
}
}