Type | Description | |||
Pos as ScrollRangeEnum | A ScrollrangeEnum expression that indicates whether the starting or ending position of the range is beging requested or changed. | |||
Variant | A Variant expression that indicates the date or the time when the range beings or ends. |
If you want to limit just a margin of the chart, you can handle the DateChange event to specify the correct value for the FirstVisibleDate property of the Chart object like in the following VB6 sample:
Private Function Max(a, b) If (a < b) Then Max = b Else Max = a End If End Function Private Sub G2antt1_DateChange() With G2antt1 Dim dLimit As Date dLimit = #1/1/2010# .Chart.FirstVisibleDate = Max(dLimit, .Chart.FirstVisibleDate) .ScrollPartEnable(exHChartScroll, exLeftBPart) = .Chart.FirstVisibleDate > dLimit End With End Sub
The sample limits the FirstVisibleDate property of the chart so it won't be less than January 1st of 2010, and disables the left scroll button in the chart if FirstVisibleDate property is at limit.
The following VB sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:
With G2antt1 .Columns.Add "Task" With .Chart .LevelCount = 2 .PaneWidth(0) = 56 .ScrollRange(exStartDate) = "1/1/2001" .ScrollRange(exEndDate) = "1/31/2001" .FirstVisibleDate = "1/12/2001" End With With .Items h = .AddItem("Task 1") .AddBar h,"Task","1/15/2001","1/18/2001","K1" h = .AddItem("Task 1") .AddBar h,"Task","1/5/2001","1/11/2001","K1" End With End With
The following VB.NET sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:
Dim h With AxG2antt1 .Columns.Add "Task" With .Chart .LevelCount = 2 .PaneWidth(0) = 56 .ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exStartDate) = "1/1/2001" .ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exEndDate) = "1/31/2001" .FirstVisibleDate = "1/12/2001" End With With .Items h = .AddItem("Task 1") .AddBar h,"Task","1/15/2001","1/18/2001","K1" h = .AddItem("Task 1") .AddBar h,"Task","1/5/2001","1/11/2001","K1" End With End With
The following C# sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:
axG2antt1.Columns.Add("Task"); EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart; var_Chart.LevelCount = 2; var_Chart.set_PaneWidth(0 != 0,56); var_Chart.set_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exStartDate,"1/1/2001"); var_Chart.set_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exEndDate,"1/31/2001"); var_Chart.FirstVisibleDate = "1/12/2001"; EXG2ANTTLib.Items var_Items = axG2antt1.Items; int h = var_Items.AddItem("Task 1"); var_Items.AddBar(h,"Task","1/15/2001","1/18/2001","K1",null); h = var_Items.AddItem("Task 1"); var_Items.AddBar(h,"Task","1/5/2001","1/11/2001","K1",null);
The following C++ sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:
/* 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 "D:\\Exontrol\\ExG2antt\\project\\Debug\\ExG2antt.dll" using namespace EXG2ANTTLib; */ EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown(); spG2antt1->GetColumns()->Add(L"Task"); EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart(); var_Chart->PutLevelCount(2); var_Chart->PutPaneWidth(0,56); var_Chart->PutScrollRange(EXG2ANTTLib::exStartDate,"1/1/2001"); var_Chart->PutScrollRange(EXG2ANTTLib::exEndDate,"1/31/2001"); var_Chart->PutFirstVisibleDate("1/12/2001"); EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems(); long h = var_Items->AddItem("Task 1"); var_Items->AddBar(h,"Task","1/15/2001","1/18/2001","K1",vtMissing); h = var_Items->AddItem("Task 1"); var_Items->AddBar(h,"Task","1/5/2001","1/11/2001","K1",vtMissing);
The following VFP sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:
Dim h With AxG2antt1 .Columns.Add "Task" With .Chart .LevelCount = 2 .PaneWidth(0) = 56 .ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exStartDate) = "1/1/2001" .ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exEndDate) = "1/31/2001" .FirstVisibleDate = "1/12/2001" End With With .Items h = .AddItem("Task 1") .AddBar h,"Task","1/15/2001","1/18/2001","K1" h = .AddItem("Task 1") .AddBar h,"Task","1/5/2001","1/11/2001","K1" End With End With