Search
Box.AddLabel Method
See Also
 



Adds the specified label to this node.

 Syntax

VB6  Copy Code

Public Sub AddLabel( _
    ByVal label As NodeLabel _
)

C++  Copy Code

public:
void AddLabel (
    NodeLabel* label
)

 Parameters

label

A NodeLabel instance.

 Remarks

Main text content of a box is specified via its Text property. Call AddLabel if you need to display additional text labels, such as identifiers or hints to the user.

Position of labels can be specified by calling methods such as SetCornerPosition. You can let users move labels interactively by setting the Behavior property of FlowChart to bhMoveLabels.

 Example

The following BoxCreated event handler adds a label to the top-left corner of newly drawn nodes.

VB6  Copy Code
Sub fcx_BoxCreated(ByVal box As FLOWCHARTLibCtl.IBoxItem)
    Dim label As NodeLabel
    Set label = New NodeLabel
    label.Text = "id: 1"
    label.SetCornerPosition 0, 0, 0
    label.VerticalAlign = saNear
    label.HorizontalAlign = saNear
    box.AddLabel label
End Sub
C++  Copy Code

#include "MFC wrapper/NodeLabel.h"

void DiagramWindow::OnBoxCreated(LPDISPATCH pBoxItem)
{
    BoxItem box = pBoxItem;

    NodeLabel label;
    label.CreateDispatch(_T("FlowChartPro.NodeLabel"));
    label.SetText(_T("id: 1"));
    label.SetCornerPosition(0, 0, 0);
    label.SetVerticalAlign(saNear);
    label.SetHorizontalAlign(saNear);
    box.AddLabel(label);

    box.DetachDispatch();
}

 See Also