TdxSpreadSheetTableViewHitTest.Container Property
Provides access to the floating container object whose client area is located at the inspected point within the Table View worksheet.
Declaration
property Container: TdxSpreadSheetContainer read;
Property Value
Type |
---|
TdxSpreadSheetContainer |
Remarks
This property returns a generic floating container object providing access only to the properties and methods that are common to all supported types of container objects. To access the container type-specific members, you need to cast the returned object to the actual container type (TdxSpreadSheetPictureContainer or TdxSpreadSheetShapeContainer). Refer to the following code example to learn how to work with the Container property:
var
AImage: TdxSmartImage;
ATableView: TdxSpreadSheetTableView;
AShapeContainer: TdxSpreadSheetShapeContainer;
APictureContainer: TdxSpreadSheetPictureContainer;
//...
// Access the active worksheet's Table View
ATableView := TdxSpreadSheetTableView(dxSpreadSheet1.ActiveSheet);
if(ATableView.HitTest.HitObject <> nil) then // Check if there is an object under the mouse pointer
begin
// Check if the object under the mouse pointer is exactly a picture container
if(ATableView.HitTest.HitObject.ToString = 'TdxSpreadSheetPictureContainerViewInfo') then
// Cast the generic container object to the picture container object
APictureContainer := TdxSpreadSheetPictureContainer(ATableView.HitTest.Container);
// Check if the object under the mouse pointer is exactly a shape container
if(ATableView.HitTest.HitObject.ToString = 'TdxSpreadSheetShapeContainerViewInfo') then
// Cast the generic container object to the shape container object
AShapeContainer := TdxSpreadSheetShapeContainer(ATableView.HitTest.Container);
end;
//...
if(OpenDialog1.Execute(Handle)) then // Open the dialog box for selecting an image for the container
begin
AImage := TdxSmartImage.Create;
AImage.LoadFromFile(OpenDialog1.FileName); // Load an image
// Access the picture container-specific property
APictureContainer.Picture.Image := AImage; // Assign an image to the container
AImage.Free;
end;
//...
// Access the shape container-specific property
AShapeContainer.Shape.ShapeType := stRoundRect; // Assign the rounded rectangle shape to the shape container
See Also