FMX.AddressBook.TAddressBookContact.Photo
Delphi
property Photo: TBitmapSurface index TContactField.Photo read GetBitmapValue write SetBitmapValue;
C++
__property Fmx::Surfaces::TBitmapSurface* Photo = {read=GetBitmapValue, write=SetBitmapValue, index=12};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | FMX.AddressBook.pas FMX.AddressBook.hpp |
FMX.AddressBook | TAddressBookContact |
Description
Specifies the contact person photo.
Use this property to save or retrieve the contact person photo. The following sample codes illustrate how to save the contact photo in your Delphi and C++Builder applications.
Examples
The following sample codes iilustrate how to create the John Doe contact with a photo.
Note In this scenario, the contact person photo can be loaded from a device camera or gallery. For more information and samples, see Taking and Sharing Pictures and Text Using Action Lists.
Delphi:
var
Contact: TAddressBookContact;
Photo: TBitmapSurface;
Image1 : TImage; // Load an image from a device camera or gallery.
begin
Contact := AddressBook1.CreateContact(AddressBook1.DefaultSource);
try
Contact.FirstName := 'John';
Contact.LastName := 'Doe';
// Specify the contact person photo
Photo := TBitmapSurface.Create;
try
Photo.Assign(Image1.Bitmap);
Contact.Photo := Photo;
finally
Photo.Free;
end;
AddressBook1.SaveContact(Contact);
finally
Contact.Free;
end;
end;
C++Builder:
TAddressBookContact *Contact;
TImage *Image1; // Load an image from a device camera or gallery
Contact = AddressBook1->CreateContact(AddressBook1->DefaultSource());
__try {
Contact->FirstName = "John";
Contact->LastName = "Doe";
// Specify the contact person photo
TBitmapSurface *photo = new TBitmapSurface();
__try {
photo->Assign(Image1->Bitmap);
Contact->Photo = photo;
}
__finally {
photo->Free();
}
AddressBook1->SaveContact(Contact);
}
__finally {
Contact->Free();
}