Framework / Presentation Layer / Smart Shapes / Shape Sheet / Controls Section

In This Topic
    Controls Section
    In This Topic

    The controls section is used to define the control points of a smart shape. It is an optional section, which is represented by an instance of the NControlsSection class. This section is created and accessed by the ControlsSection property:

    C#
    Copy Code
    // create the controls section and add a control row
    sheet.ControlsSection = new NControlsSection();
    sheet.ControlsSection.AddControl("Width*0", "Height/2-10", true, ControlBehavior.Locked, ControlBehavior.OffsetFromCenter, "First control point");
    
    Visual Basic
    Copy Code
    ' create the controls section and add a control row
    sheet.ControlsSection = New NControlsSection()
    sheet.ControlsSection.AddControl("Width*0", "Height/2-10", true, ControlBehavior.Locked, ControlBehavior.OffsetFromCenter, "First control point")
    
     Control Rows

    The Rows collection of the controls section is used to store control rows. They are represented by instances of the NControlsRow class. Each controls row defines a single control point. Currently this type of row defines six cells, each of which corresponds to a specific aspect of the control point. The following table summarizes the controls row cells:

    The XBehavior and YBehavior cells are instances of the NControlBehaviorFormulaCell class. This is a strongly typed cell, which stores a value from the ControlBehavior enumeration. In this way the XBehavior and YBehavior cells evaluate to one of the following values:

    • Proportional - the coordinate is defined proportionally to the respective path dimension (Width or Height). When you move the control handle the smart shape will update the proportion coefficient. For example: Height*0.6.
    • Locked - the coordinate is locked to its original value. When you move the control handle the coordinate is not updated (e.g. preserves the original state of the cell).
    • OffsetFromNearSide - the coordinate is defined with a constant distance from the near side (Left or Top). When you move the control handle the constant distance in the formula is updated. This behavior anchors the coordinate to the near side. 
    • OffsetFromCenter - the coordinate is defined with a constant distance from the center. When you move the control handle the constant distance in the formula is updated. This behavior anchors the coordinate to the center. For example: Height/2+10
    • OffsetFromFarSide - the coordinate is defined with a constant distance from the far side (Right or Bottom) . When you move the control handle the constant distance in the formula is updated. This behavior anchors the coordinate to the far side. For example: Height-10

    The  NControlsSection class provides several overrides of the AddControl method, which let you easily add control rows to this section. 

    See Also