Type | Description | |||
LinkKey as Variant | A String expression that indicates the key of the link. This value is used to identify the link. | |||
StartItem as HITEM | A HITEM expression that indicates the handle of the item where the link starts. | |||
StartBarKey as Variant | A String expression that indicates the key of the bar in the StartItem where the link starts. | |||
EndItem as HITEM | A HITEM expression that indicates the handle of the item where the link ends. | |||
EndBarKey as Variant | A String expression that indicates the key of the bar in the EndItem where the link ends. |
The following VB sample adds a link between two bars:
Gantt1.BeginUpdate With Gantt1.Items Dim h1 As HITEM h1 = .AddItem("Item 1") .AddBar h1, "Task", Gantt1.Chart.FirstVisibleDate + 2, Gantt1.Chart.FirstVisibleDate + 4 Dim h2 As HITEM h2 = .AddItem("Item 2") .AddBar h2, "Task", Gantt1.Chart.FirstVisibleDate + 1, Gantt1.Chart.FirstVisibleDate + 2, "A" .AddLink "Link11", h1, "", h2, "A" End With Gantt1.EndUpdate
The following C++ sample adds a link between two bars:
COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; m_gantt.BeginUpdate(); CItems items = m_gantt.GetItems(); CChart chart = m_gantt.GetChart(); long h1 = items.AddItem( COleVariant( "Item1" ) ); items.AddBar( h1, COleVariant( "Task" ), COleVariant( V_DATE(&chart.GetFirstVisibleDate()) + 2 ), COleVariant( V_DATE(&chart.GetFirstVisibleDate()) + 4 ), vtMissing, vtMissing ); long h2 = items.AddItem( COleVariant( "Item2" ) ); items.AddBar( h2, COleVariant( "Task" ), COleVariant( V_DATE(&chart.GetFirstVisibleDate()) + 1 ), COleVariant( V_DATE(&chart.GetFirstVisibleDate()) + 2 ), COleVariant("JustAKey"), vtMissing ); items.AddLink( COleVariant( "Link1" ), h1, vtMissing, h2, COleVariant("JustAKey") ); m_gantt.EndUpdate();
The following VB.NET sample adds a link between two bars:
AxGantt1.BeginUpdate() Dim d As Date = AxGantt1.Chart.FirstVisibleDate With AxGantt1.Items Dim h1 As Integer = .AddItem("Item 1") .AddBar(h1, "Task", d.AddDays(2), d.AddDays(4)) Dim h2 As Integer = .AddItem("Item 2") .AddBar(h2, "Task", d.AddDays(1), d.AddDays(2), "A") .AddLink("Link11", h1, "", h2, "A") End With AxGantt1.EndUpdate()
The following C# sample adds a link between two bars:
axGantt1.BeginUpdate(); DateTime d = Convert.ToDateTime(axGantt1.Chart.FirstVisibleDate); EXGANTTLib.Items spItems = axGantt1.Items; int h1 = spItems.AddItem("Item 1"); spItems.AddBar(h1, "Task", d.AddDays(2), d.AddDays(4) , null, null); int h2 = spItems.AddItem("Item 2"); spItems.AddBar(h2, "Task", d.AddDays(1), d.AddDays(2), "A", null); spItems.AddLink("Link1", h1, null, h2, "A"); axGantt1.EndUpdate();
The following VFP sample adds a link between two bars:
thisform.Gantt1.BeginUpdate local d d = thisform.Gantt1.Chart.FirstVisibleDate With thisform.Gantt1.Items local h1 .DefaultItem = .AddItem("Item 1") h1 = .DefaultItem .AddBar(0, "Task", thisform.Gantt1.Chart.NextDate(d,4096,2), thisform.Gantt1.Chart.NextDate(d,4096,4)) local h2 .DefaultItem = .AddItem("Item 2") h2 = .DefaultItem .AddBar(0, "Task", thisform.Gantt1.Chart.NextDate(d,4096,1), thisform.Gantt1.Chart.NextDate(d,4096,2), "A") .AddLink("Link11", h1, "", h2, "A") EndWith thisform.Gantt1.EndUpdate