![]() | Type | Description | ||
| StartItem as HITEM | A Long expression that specifies the handle of the item that hosts the bar where the link starts. | |||
| StartBarKey as Variant | A VARIANT expression that specifies the key of the bar where the link starts. | |||
| EndItem as HITEM | A Long expression that specifies the handle of the item that hosts the bar where the link ends. | |||
| EndBarKey as Variant | A VARIANT expression that specifies the key of the bar where the link ends. | |||
| LinkKey as Variant | A String expression that specifies the next available key for the link. Use the LinkKey parameter to change the default key for the newly added link at runtime. | |||
| Cancel as Boolean | A Boolean expression that specifies whether the operation can continue. By default, the Cancel parameter is False. If The Cancel parameter is True, the specified two bars can not be linked, so the link operation is cancelled. |
At runtime, you can control linking two bars using one of the followings:
The following VB sample disable linking bars to any "Summary" bars:
Private Sub G2antt1_AllowLink(ByVal StartItem As EXG2ANTTLibCtl.HITEM, ByVal StartBarKey As Variant, ByVal EndItem As EXG2ANTTLibCtl.HITEM, ByVal EndBarKey As Variant, LinkKey As Variant, Cancel As Boolean)
With G2antt1.Items
If (.ItemBar(StartItem, StartBarKey, exBarName) = "Summary") Then
Cancel = True
Else
If (.ItemBar(EndItem, EndBarKey, exBarName) = "Summary") Then
Cancel = True
End If
End If
End With
End Sub
Use the AddLink method to create a link between two bars. Use the Link property to access properties of a specified link. The Link(exLinksCount) property retrieves the number of links within the chart.