Version

Grouping Shapes (Infragistics Excel Engine)

Topic Overview

Purpose

This topic demonstrates how to group two or more shapes.

Required background

You need to first read the following topics:

Introduction

A group of shapes is a structure consisting of two or more that behave like one shape. Working with groups of shapes is similar to working with Worksheet Class and WorksheetShape Class.

To group two or more shapes ensure you have the shapes initialized, then initialize a WorksheetShapeGroup object and add the shapes to its Shapes collection.

The procedure that follows demonstrates how to group two already initialized shapes.

Grouping Excel Shapes

Requirements

To complete the procedure, you need the following:

Overview

Following is a conceptual overview of the process:

  1. Initialize two shapes

  2. Group the shapes

  3. Set position and size. Add to a worksheet.

Steps

  1. Initialize two shapes

    Name the objects shape1 and shape2. To complete this step refer to the Adding a Shape to a Worksheet topic.

  1. Group the shapes

    Initialize a new WorksheetShapeGroup object and add the shapes to its Shapes collection.

    In Visual Basic:

    Dim shapeGroup As New WorksheetShapeGroup()
    shapeGroup.Shapes.Add(shape1)
    shapeGroup.Shapes.Add(shape2)

    In C#:

    WorksheetShapeGroup shapeGroup = new WorksheetShapeGroup();
    shapeGroup.Shapes.Add(shape1);
    shapeGroup.Shapes.Add(shape2);
  1. Set position and size. Add to a worksheet.

    WorksheetShapeGroup Class derives from WorksheetShape Class, so everything about sizing, positioning, adding to a sheet and etc is the same as Adding a Shape to a Worksheet.