All docs
V20.2
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

NestedShapeCollection.AddGroup() Method

Adds a nested group to an existing shape group or a drawing canvas.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v20.2.Core.dll

Declaration

NestedShape AddGroup()
Function AddGroup As NestedShape

Returns

Type Description
NestedShape

The nested group.

Remarks

Add a Shape Group to a Drawing Canvas

Call the ShapeCollection.InsertCanvas method to add a drawing canvas to a document. Use the Shape.CanvasItems property to access the collection of canvas items. The collection's Add methods allow you to add shapes and shape groups to the canvas.

The example below creates a drawing canvas that contains two shape groups.

Add shape groups to a canvas

Document document = wordProcessor.Document;
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Insert a drawing canvas.
Shape canvas = document.Shapes.InsertCanvas(document.Range.Start, new RectangleF(1f, 1f, 6.2f, 1f));
// Access the collection of canvas items. 
var canvasItems = canvas.CanvasItems;
// Add the first shape group to the canvas.
var group1 = canvasItems.AddGroup();
// Add shapes to the group.
var arrow1 = group1.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(0f, 0f, 1.7f, 1f));
arrow1.Fill.SetSolidFill(Color.FromArgb(0xA4, 0xFF, 0xFF));
arrow1.Line.Color = Color.DarkGray;
arrow1.Line.Thickness = 1;
var arrow2 = group1.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(1.5f, 0f, 1.7f, 1f));
arrow2.Fill.SetSolidFill(Color.FromArgb(0xA1, 0xF9, 0xA1));
arrow2.Line.Color = Color.DarkGray;
arrow2.Line.Thickness = 1;
// Add the second shape group to the canvas.
var group2 = canvasItems.AddGroup();
// Add shapes to the group.
var arrow3 = group2.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(3f, 0f, 1.7f, 1f));
arrow3.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xA5, 0xA5));
arrow3.Line.Color = Color.DarkGray;
arrow3.Line.Thickness = 1;
var arrow4 = group2.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(4.5f, 0f, 1.7f, 1f));
arrow4.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xC9, 0xA5));
arrow4.Line.Color = Color.DarkGray;
arrow4.Line.Thickness = 1;

Add a Nested Group to an Existing Shape Group

Call the ShapeCollection.InsertGroup method to create a shape group. The Shape.GroupItems property returns the collection of group items. Use the collection's Add methods to add shapes and nested groups to the newly created group.

The example below creates a shape group with two nested groups.

Add nested groups to an existing shape group

Document document = wordProcessor.Document;
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Insert a shape group.
Shape group = document.Shapes.InsertGroup(document.Range.Start);
// Specify the group position relative to the left and top edges of the page. 
group.Offset = new PointF(1f, 1f);
// Access the collection of group items. 
var groupItems = group.GroupItems;
// Add the first nested group to the shape group.
var group1 = groupItems.AddGroup();
// Add shapes to the nested group.
var arrow1 = group1.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(0f, 0f, 1.7f, 1f));
arrow1.Fill.SetSolidFill(Color.FromArgb(0xA4, 0xFF, 0xFF));
arrow1.Line.Color = Color.DarkGray;
arrow1.Line.Thickness = 1;
var arrow2 = group1.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(1.5f, 0f, 1.7f, 1f));
arrow2.Fill.SetSolidFill(Color.FromArgb(0xA1, 0xF9, 0xA1));
arrow2.Line.Color = Color.DarkGray;
arrow2.Line.Thickness = 1;
// Add the second nested group to the shape group.
var group2 = groupItems.AddGroup();
// Add shapes to the nested group.
var arrow3 = group2.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(3f, 0f, 1.7f, 1f));
arrow3.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xA5, 0xA5));
arrow3.Line.Color = Color.DarkGray;
arrow3.Line.Thickness = 1;
var arrow4 = group2.GroupItems.AddShape(ShapeGeometryPreset.NotchedRightArrow, new RectangleF(4.5f, 0f, 1.7f, 1f));
arrow4.Fill.SetSolidFill(Color.FromArgb(0xFF, 0xC9, 0xA5));
arrow4.Line.Color = Color.DarkGray;
arrow4.Line.Thickness = 1;
See Also