Nevron .NET Vision
Framework / Presentation Layer / Smart Shapes / Smart Groups

In This Topic
    Smart Groups
    In This Topic

    Smart Groups are smart shapes, which can contain other smart shapes. Smart Groups are represented by an instance the NSmartGroup class (derived from NSmartShape class). The shapes contained in a group are stored in an instance of the NSmartShapeCollection class, which can be obtained from the Shapes property. The following example creates a smart group with two child shapes:

    C#
    Copy Code
    // create the group
    NSmartGroup group = new NSmartGroup();
    // create shape1 and add it in the group
    NSmartShape shape1 = new NSmartShape();
    group.Shapes.Add(shape1);
    // create shape2 and add it in the group
    NSmartShape shape2 = new NSmartShape();
    group.Shapes.Add(shape2);
    
    Visual Basic
    Copy Code
    ' create the group
    Dim group As New new NSmartGroup()
    ' create shape1 and add it in the group
    Dim shape1 As New NSmartShape()
    group.Shapes.Add(shape1)
    ' create shape2 and add it in the group
    Dim shape2 As New NSmartShape()
    group.Shapes.Add(shape2)
    
     Referencing the Group Shape Sheet from the Child Shapes Sheets

    The shape sheets of the child shapes can reference the shape sheet of the group. This is achieved by adding the Group! prefix before the group local cell name (see Formula Cell References for more information about cell references). For example:

    C#
    Copy Code
    // make the shape1 width half the width of the group
    shape1.Transform.Width.Formula = "Group!Width/2";
    
    Visual Basic
    Copy Code
    ' make the shape1 width half the width of the group
    shape1.Transform.Width.Formula = "Group!Width/2"
    

    This yields to incredible flexibility and interdependency between child shapes their groups, which allows the creation of very complex shapes.

     When to Use Groups
    You would typically use groups, when you want to create shapes, which consist of several components with different appearance. This is because although smart shapes can be used to display several graphics paths (there can be several geometry sections in the smart shape sheet), they are all displayed with the same fill and stroke styles.
    See Also