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) are empty. The control scrolls the chart within specified range, only if the ScrollRange(exStartDate) and ScrollRange(exEndDate) are not empty and they are indicating two different dates. So, if the ScrollRange(exStartDate) and ScrollRange(exEndDate) properties are the same, the ScrollRange property has no effect. 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. 

The following VB sample disables the left and right scroll bar buttons, and specifies a range of date to scroll within:

With Gantt1
	.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 AxGantt1
	.Columns.Add "Task"
	With .Chart
		.LevelCount = 2
		.PaneWidth(0) = 56
		.ScrollRange(EXGANTTLib.ScrollRangeEnum.exStartDate) = "1/1/2001"
		.ScrollRange(EXGANTTLib.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:

axGantt1.Columns.Add("Task");
EXGANTTLib.Chart var_Chart = axGantt1.Chart;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(0 != 0,56);
	var_Chart.set_ScrollRange(EXGANTTLib.ScrollRangeEnum.exStartDate,"1/1/2001");
	var_Chart.set_ScrollRange(EXGANTTLib.ScrollRangeEnum.exEndDate,"1/31/2001");
	var_Chart.FirstVisibleDate = "1/12/2001";
EXGANTTLib.Items var_Items = axGantt1.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 'EXGANTTLib' for the library: 'ExGantt 1.0 Control Library'

	#import "D:\\Exontrol\\ExGantt\\project\\DemoU\\ExGantt.dll"
	using namespace EXGANTTLib;
*/
EXGANTTLib::IGanttPtr spGantt1 = GetDlgItem(IDC_GANTT1)->GetControlUnknown();
spGantt1->GetColumns()->Add(L"Task");
EXGANTTLib::IChartPtr var_Chart = spGantt1->GetChart();
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(0,56);
	var_Chart->PutScrollRange(EXGANTTLib::exStartDate,"1/1/2001");
	var_Chart->PutScrollRange(EXGANTTLib::exEndDate,"1/31/2001");
	var_Chart->PutFirstVisibleDate("1/12/2001");
EXGANTTLib::IItemsPtr var_Items = spGantt1->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:

with thisform.Gantt1
	.Columns.Add("Task")
	with .Chart
		.LevelCount = 2
		.PaneWidth(0) = 56
		.ScrollRange(0) = "1/1/2001"
		.ScrollRange(1) = "1/31/2001"
		.FirstVisibleDate = "1/12/2001"
	endwith
	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")
	endwith
endwith


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.