Vcl.ShareContract.TCustomSharingContract.OnTransferImage

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnTransferImage: TTransferDataEvent read GetOnTransferImage write SetOnTransferImage;

C++

__property System::Win::Sharecontract::TTransferDataEvent OnTransferImage = {read=GetOnTransferImage, write=SetOnTransferImage};

Properties

Type Visibility Source Unit Parent
event public
Vcl.ShareContract.pas
Vcl.ShareContract.hpp
Vcl.ShareContract TCustomSharingContract

Description

Occurs when the image sharing begins.

If you do not provide an event handler for this event, the image that is shared is the ImageFile (if provided).

Otherwise, your event handler may provide any stream to be shared. For example, if you want to share a picture from a camera, you may provide it directly for the target application, as a stream.

The following code snippet demonstrates how to share an image in the same way as the framework does (you can achieve an identical result by setting the 'Penguins.jpg' as the ImageFile).

Delphi:

procedure TForm1.ShareContractComponentTranferImage(const Sender: TObject; const ARequest: IDataProviderRequest);
begin
  ARequest.SetData(TShareContract.FileNameToStream('Penguins.jpg'));
end;

C++:

void __fastcall TFormº1::SharingContractTranferImage(TObject * const Sender,
	IDataProviderRequest * const ARequest)
{
  ARequest->SetData(TShareContract::FileNameToStream("Penguins.jpg");
}

See Also