![]() | Type | Description | ||
| LinkKey as String | A String expression that indicates the key of the link being added. |
The AddLink event may occur only if the AllowLinkBars property is True. The LinkKey parameter indicates the key of the newly added link. Use the Link property of the Items object to access the properties and options of the link. Use the RemoveLink method to remove the link, if you don't need certain links to be added. The FirstLink property retrieves the key of the first link in the chart. Use the NextLink property to retrieve the key of the next link, in the chart. Use these properties to enumerate the link in the control. Use the CellValue property to access the cell's value.
The following VB sample changes the style of the link if certain condition is met ( in this sample, the cell on the first column is called "Root" ):
Private Sub G2antt1_AddLink(ByVal LinkKey As String)
With G2antt1.Items
If .CellValue(.Link(LinkKey, exLinkStartItem), 0) = "Root" Then
.Link(LinkKey, exLinkStyle) = exLinkSolid
.Link(LinkKey, exLinkWidth) = 2
.Link(LinkKey, exLinkColor) = RGB(255, 0, 0)
End If
End With
End SubThe sample checks whether the cell's value on the first column where the link starts is "Root", and if so, the style of the link is changed to a red thin link.