Skip to main content

TdxSpreadSheetPictureContainer Class

A floating container with the image support.

Declaration

TdxSpreadSheetPictureContainer = class(
    TdxSpreadSheetShapeContainer
)

Remarks

Picture containers are different floating shapes that display loaded bitmaps. Since the TdxSpreadSheetPictureContainer class is the direct descendant of TdxSpreadSheetShapeContainer, it provides the same selection of available geometric shapes. Likewise, it supports transparency and various transformations.

The TdxSpreadSheetPictureContainer class extends its ancestor with the following members that allow you to:

  • Assign and customize the bitmap image used to fill the picture container’s shape (Picture);

  • Specify whether an end-user is able to change the bitmap’s aspect ratio by using the container’s corner sizing handles (RelativeResize).

TdxSpreadSheetPictureContainer objects are referenced by the worksheet‘s Containers collection as TdxSpreadSheetContainer objects, providing access only to the properties and methods that are common to all supported container types. To access the type-specific members of a picture container object, you need to cast it to the TdxSpreadSheetPictureContainer type.

The following code example demonstrates how to access the Picture property provided by the TdxSpreadSheetPictureContainer class:

var
  ATableView: TdxSpreadSheetTableView;
  AContainer: TdxSpreadSheetPictureContainer;
  AImage: TdxSmartImage;
//...
  ATableView := TdxSpreadSheetTableView(dxSpreadSheet1.ActiveSheet);
//...
  if(OpenDialog1.Execute(Handle)) then  // Open the dialog box for selecting an image for the container
    begin
      ATableView.Containers.Add(TdxSpreadSheetPictureContainer);  // Create the picture container
      AContainer := TdxSpreadSheetPictureContainer(ATableView.Containers.Last);
      AContainer.BeginUpdate;
      AImage := TdxSmartImage.Create;
      AImage.LoadFromFile(OpenDialog1.FileName);  // Load an image
      AContainer.Picture.Image := AImage;  // Assign an image to the container
      AImage.Free;
      AContainer.AnchorType := catTwoCell;
      AContainer.AnchorPoint1.Cell := ATableView.CreateCell(0, 0);
      AContainer.AnchorPoint2.Cell := ATableView.CreateCell(4, 2);
      AContainer.EndUpdate;
     end;

Note

In order to create a TdxSpreadSheetPictureContainer object, call the worksheet’s Containers.Add method. For additional information, refer to the Picture-Specific Settings topic.

See Also