Vcl.ShareContract.TSharingContract.OnTransferImage
Delphi
property OnTransferImage;
C++
__property OnTransferImage;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | published | Vcl.ShareContract.pas Vcl.ShareContract.hpp |
Vcl.ShareContract | TSharingContract |
Description
Occurs when the image sharing begins.
Vcl.ShareContract.TSharingContract.OnTransferImage inherits from Vcl.ShareContract.TCustomSharingContract.OnTransferImage. All content below this line refers to Vcl.ShareContract.TCustomSharingContract.OnTransferImage. 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");
}