property Chart.ScrollRange(Pos as ScrollRangeEnum) as Variant
Specifies the range of dates to scroll within.

TypeDescription
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.
By default, the ScrollRange(exStartDate) and ScrollRange(exEndDate) properties are empty. The control scrolls the chart within specified range, only if the ScrollRange(exStartDate) and ScrollRange(exEndDate) are not empty and indicates a valid date-time value. If the ScrollRange(exStartDate) and ScrollRange(exEndDate) properties indicates the same valid value, the ScrollRange limits the view to specified unit. For instance, if both are set on #1/1/2001# the view is limited to full day, in case it is zoomed to hours, minutes or seconds. The ScrollRange property rearranges the FirstVisibleDate property, so it fits the range. The FirstVisibleDate indicates the first visible date or time in the chart. Use the ScrollTo method to scroll to a specified date. For instance, let's say that ScrollRange(exStartDate) is #5/1/2007#,  ScrollRange(exEndDate) is #10/1/2007#, and the FirstVisibleDate is #7/1/2007#.  This would move the first visible day to July 1st, but also move the horizontal scroll bar halfway across the chart.  This way, it would be clear to users where they are in relation to the full schedule.  The DateChange event notifies whether the first visible date is changed. Use the ScrollPartEnum property to disable specified parts in the chart's scroll bar.

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