IdxRichEditShapeCollection.GetItem(string) Method
Returns a floating shape by its name.
Declaration
function GetItem(const Name: string): IdxRichEditShape;
Parameters
Name | Type |
---|---|
Name | string |
Returns
Type |
---|
IdxRichEditShape |
Remarks
Call this function and pass the name of the target shape to obtain it. The function returns nil if there is no shape with the specified name within the collection.
var
ADocument: IdxRichEditDocument;
APictureShape: IdxRichEditShape;
begin
ADocument := dxRichEditControl1.Document;
APictureShape := ADocument.Shapes.GetItem('MyPicture');
if(APictureShape = nil) then Exit; // There is no "MyPicture" shape within the collection
// Changes the floating picture's horizontal alignment and text wrapping
APictureShape.TextWrapping := TdxRichEditTextWrappingType.Square;
APictureShape.HorizontalAlignment := TdxRichEditShapeHorizontalAlignment.Center;
end;
You can call the inherited GetItem function to obtain a shape by its index in the collection.
var
ADocument: IdxRichEditDocument;
ATextBoxShape: IdxRichEditShape;
begin
ADocument := dxRichEditControl1.Document;
if(ADocument.Shapes.Count = 0) then Exit;
ATextBoxShape := IdxReadOnlyList<IdxRichEditShape>(ADocument.Shapes).GetItem(0);
// Changes the first shape's colors
ATextBoxShape.Line.Color := TdxAlphaColors.Red;
ATextBoxShape.Fill.Color := TdxAlphaColors.Pink;
end;
The GetItem function is the Items property’s getter.
See Also