Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

IdxRichEditShapeCollection.GetItem(string) Method

Returns a floating shape by its name.

#Declaration

Delphi
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