Type | Description | |||
Links as ShowLinksEnum | A ShowLinksEnum expression that specifies the links style being accessed. | |||
LinkStyleEnum | A LinkStyleEnum expression that specifies the link to display the links. |
The ShowLinks property specifies whether the chart's links are visible or hidden. Use the LinkColor property to specify the color for all links in the chart area. Use the LinkStyle property to specify the style for all links in the chart area. Use the LinkWidth property to specify the width of the pen, in pixels, to draw the links between bars. Use the AddLink method to add programmatically a link a bar with another.
The following screen shows the links when no bar is selected:
The following screen shows the links when the bar 2 is selected:
The following VB sample makes the links that starts from selected bar being wider, while the rest being transparent:With G2antt1 .BeginUpdate .Columns.Add "Tasks" With .Chart .FirstVisibleDate = #9/20/2006# .PaneWidth(0) = 64 .ShowLinksWidth(exShowLinksStartFrom) = 2 .ShowLinksStyle(exShowLinksStartFrom) = exLinkDot .ShowLinksColor(exShowLinksEndTo) = RGB(200,200,200) .ShowLinksColor(exShowUnselectedLinks) = RGB(200,200,200) End With With .Items h1 = .AddItem("Task 1") .AddBar h1,"Task",#9/21/2006#,#9/23/2006# h2 = .AddItem("Task 2") .AddBar h2,"Task",#9/25/2006#,#9/27/2006# .ItemBar(h2,"",exBarSelected) = True .AddLink "L1",h1,"",h2,"" .Link("L1",exLinkText) = "L1" h3 = .AddItem("Task 3") .AddBar h3,"Task",#9/29/2006#,#10/2/2006# .AddLink "L2",h2,"",h3,"" .Link("L2",exLinkText) = "L2" End With .EndUpdate End WithThe following VB.NET sample makes the links that starts from selected bar being wider, while the rest being transparent:
Dim h1,h2,h3 With AxG2antt1 .BeginUpdate .Columns.Add "Tasks" With .Chart .FirstVisibleDate = #9/20/2006# .PaneWidth(0) = 64 .ShowLinksWidth(EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom) = 2 .ShowLinksStyle(EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom) = EXG2ANTTLib.LinkStyleEnum.exLinkDot .ShowLinksColor(EXG2ANTTLib.ShowLinksEnum.exShowLinksEndTo) = 13158600 .ShowLinksColor(EXG2ANTTLib.ShowLinksEnum.exShowUnselectedLinks) = 13158600 End With With .Items h1 = .AddItem("Task 1") .AddBar h1,"Task",#9/21/2006#,#9/23/2006# h2 = .AddItem("Task 2") .AddBar h2,"Task",#9/25/2006#,#9/27/2006# .ItemBar(h2,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarSelected) = True .AddLink "L1",h1,"",h2,"" .Link("L1",EXG2ANTTLib.LinkPropertyEnum.exLinkText) = "L1" h3 = .AddItem("Task 3") .AddBar h3,"Task",#9/29/2006#,#10/2/2006# .AddLink "L2",h2,"",h3,"" .Link("L2",EXG2ANTTLib.LinkPropertyEnum.exLinkText) = "L2" End With .EndUpdate End WithThe following C++ sample makes the links that starts from selected bar being wider, while the rest being transparent:
/* Copy and paste the following directives to your header file as it defines the namespace 'EXG2ANTTLib' for the library: 'ExG2antt 1.0 Control Library' #import <ExG2antt.dll> using namespace EXG2ANTTLib; */ EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown(); spG2antt1->BeginUpdate(); spG2antt1->GetColumns()->Add(L"Tasks"); EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart(); var_Chart->PutFirstVisibleDate("9/20/2006"); var_Chart->PutPaneWidth(0,64); var_Chart->PutShowLinksWidth(EXG2ANTTLib::exShowLinksStartFrom,2); var_Chart->PutShowLinksStyle(EXG2ANTTLib::exShowLinksStartFrom,EXG2ANTTLib::exLinkDot); var_Chart->PutShowLinksColor(EXG2ANTTLib::exShowLinksEndTo,RGB(200,200,200)); var_Chart->PutShowLinksColor(EXG2ANTTLib::exShowUnselectedLinks,RGB(200,200,200)); EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems(); long h1 = var_Items->AddItem("Task 1"); var_Items->AddBar(h1,"Task","9/21/2006","9/23/2006",vtMissing,vtMissing); long h2 = var_Items->AddItem("Task 2"); var_Items->AddBar(h2,"Task","9/25/2006","9/27/2006",vtMissing,vtMissing); var_Items->PutItemBar(h2,"",EXG2ANTTLib::exBarSelected,VARIANT_TRUE); var_Items->AddLink("L1",h1,"",h2,""); var_Items->PutLink("L1",EXG2ANTTLib::exLinkText,"L1"); long h3 = var_Items->AddItem("Task 3"); var_Items->AddBar(h3,"Task","9/29/2006","10/2/2006",vtMissing,vtMissing); var_Items->AddLink("L2",h2,"",h3,""); var_Items->PutLink("L2",EXG2ANTTLib::exLinkText,"L2"); spG2antt1->EndUpdate();The following C# sample makes the links that starts from selected bar being wider, while the rest being transparent:
axG2antt1.BeginUpdate(); axG2antt1.Columns.Add("Tasks"); EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart; var_Chart.FirstVisibleDate = "9/20/2006"; var_Chart.set_PaneWidth(0 != 0,64); var_Chart.set_ShowLinksWidth(EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom,2); var_Chart.set_ShowLinksStyle(EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom,EXG2ANTTLib.LinkStyleEnum.exLinkDot); var_Chart.set_ShowLinksColor(EXG2ANTTLib.ShowLinksEnum.exShowLinksEndTo,13158600); var_Chart.set_ShowLinksColor(EXG2ANTTLib.ShowLinksEnum.exShowUnselectedLinks,13158600); EXG2ANTTLib.Items var_Items = axG2antt1.Items; int h1 = var_Items.AddItem("Task 1"); var_Items.AddBar(h1,"Task","9/21/2006","9/23/2006",null,null); int h2 = var_Items.AddItem("Task 2"); var_Items.AddBar(h2,"Task","9/25/2006","9/27/2006",null,null); var_Items.set_ItemBar(h2,"",EXG2ANTTLib.ItemBarPropertyEnum.exBarSelected,true); var_Items.AddLink("L1",h1,"",h2,""); var_Items.set_Link("L1",EXG2ANTTLib.LinkPropertyEnum.exLinkText,"L1"); int h3 = var_Items.AddItem("Task 3"); var_Items.AddBar(h3,"Task","9/29/2006","10/2/2006",null,null); var_Items.AddLink("L2",h2,"",h3,""); var_Items.set_Link("L2",EXG2ANTTLib.LinkPropertyEnum.exLinkText,"L2"); axG2antt1.EndUpdate();The following VFP sample makes the links that starts from selected bar being wider, while the rest being transparent:
with thisform.G2antt1 .BeginUpdate .Columns.Add("Tasks") with .Chart .FirstVisibleDate = {^2006-9-20} .PaneWidth(0) = 64 .ShowLinksWidth(1) = 2 .ShowLinksStyle(1) = 2 .ShowLinksColor(2) = RGB(200,200,200) .ShowLinksColor(4) = RGB(200,200,200) endwith with .Items h1 = .AddItem("Task 1") .AddBar(h1,"Task",{^2006-9-21},{^2006-9-23}) h2 = .AddItem("Task 2") .AddBar(h2,"Task",{^2006-9-25},{^2006-9-27}) .DefaultItem = h2 .ItemBar(0,"",257) = .T. .AddLink("L1",h1,"",h2,"") .Link("L1",12) = "L1" h3 = .AddItem("Task 3") .AddBar(h3,"Task",{^2006-9-29},{^2006-10-2}) .AddLink("L2",h2,"",h3,"") .Link("L2",12) = "L2" endwith .EndUpdate endwithThe following Delphi sample makes the links that starts from selected bar being wider, while the rest being transparent:
with AxG2antt1 do begin BeginUpdate(); Columns.Add('Tasks'); with Chart do begin FirstVisibleDate := '9/20/2006'; PaneWidth[0 <> 0] := 64; ShowLinksWidth[EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom] := 2; ShowLinksStyle[EXG2ANTTLib.ShowLinksEnum.exShowLinksStartFrom] := EXG2ANTTLib.LinkStyleEnum.exLinkDot; ShowLinksColor[EXG2ANTTLib.ShowLinksEnum.exShowLinksEndTo] := 13158600; ShowLinksColor[EXG2ANTTLib.ShowLinksEnum.exShowUnselectedLinks] := 13158600; end; with Items do begin h1 := AddItem('Task 1'); AddBar(h1,'Task','9/21/2006','9/23/2006',Nil,Nil); h2 := AddItem('Task 2'); AddBar(h2,'Task','9/25/2006','9/27/2006',Nil,Nil); ItemBar[h2,'',EXG2ANTTLib.ItemBarPropertyEnum.exBarSelected] := TObject(True); AddLink('L1',h1,'',h2,''); Link['L1',EXG2ANTTLib.LinkPropertyEnum.exLinkText] := 'L1'; h3 := AddItem('Task 3'); AddBar(h3,'Task','9/29/2006','10/2/2006',Nil,Nil); AddLink('L2',h2,'',h3,''); Link['L2',EXG2ANTTLib.LinkPropertyEnum.exLinkText] := 'L2'; end; EndUpdate(); end