property Chart.AllowSelectDate as SelectDateEnum
Specifies whether the user selects dates at runtime.

 TypeDescription 
   SelectDateEnum A SelectDateEnum expression that specifies whether the user can select dates at runtime, by clicking the chart's header.  
By default, the AllowSelectDate property is True, which means that the user can select dates by clicking the chart's header. If the chart displays the histogram, it can select new dates by clicking the histogram. The selected dates are shown using the MarkSelectDateColor property, and it is different than chart's background color, BackColor property. The SelectedDates property can be used to retrieve all selected dates, or to select a collection of dates. Use the SelectDate property to select dates programmatically, no matter of AllowSelectDate property . The MarkTodayColor property specifies the color to mark the today date. Use the LevelFromPoint property to get the index of the level from the cursor. Use the DateFromPoint property to retrieve the date from the cursor. The ChartEndChanging(exSelectDate) event notifies your application when the user selects a new date by clicking the header of the chart. You can show the selected dates on the overview-map part of the control by setting the OverviewShowSelectDates property on True.

The following screen shot shows the selected dates ( Dec 2 and Dec 4 ) being colored with this EBN file:

The following VB sample shows how you can use skin / ebn files to display the selected dates:

With G2antt1
	.BeginUpdate 
	With .VisualAppearance
		.Add 1,"c:\exontrol\images\normal.ebn"
	End With
	With .Chart
		.FirstVisibleDate = #1/1/2008#
		.MarkTodayColor = .BackColor
		.LevelCount = 2
		.MarkSelectDateColor = 0x1000000
		.SelectLevel = 1
		.SelectDate(#1/3/2008#) = True
		.SelectDate(#1/4/2008#) = True
	End With
	.Columns.Add "Default"
	With .Items
		.AddBar .AddItem("Item 1"),"Task",#1/2/2008#,#1/6/2008#
		.AddBar .AddItem("Item 2"),"Task",#1/3/2008#,#1/7/2008#
		.AddBar .AddItem("Item 3"),"Task",#1/4/2008#,#1/8/2008#
		.AddBar .AddItem("Item 4"),"Task",#1/5/2008#,#1/9/2008#
	End With
	.EndUpdate 
End With
The following VB.NET sample shows how you can use skin / ebn files to display the selected dates:
With AxG2antt1
	.BeginUpdate 
	With .VisualAppearance
		.Add 1,"c:\exontrol\images\normal.ebn"
	End With
	With .Chart
		.FirstVisibleDate = #1/1/2008#
		.MarkTodayColor = .BackColor
		.LevelCount = 2
		.MarkSelectDateColor = &H1000000
		.SelectLevel = 1
		.SelectDate(#1/3/2008#) = True
		.SelectDate(#1/4/2008#) = True
	End With
	.Columns.Add "Default"
	With .Items
		.AddBar .AddItem("Item 1"),"Task",#1/2/2008#,#1/6/2008#
		.AddBar .AddItem("Item 2"),"Task",#1/3/2008#,#1/7/2008#
		.AddBar .AddItem("Item 3"),"Task",#1/4/2008#,#1/8/2008#
		.AddBar .AddItem("Item 4"),"Task",#1/5/2008#,#1/9/2008#
	End With
	.EndUpdate 
End With
The following C++ sample shows how you can use skin / ebn files to display the selected dates:
/*
	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();
EXG2ANTTLib::IAppearancePtr var_Appearance = spG2antt1->GetVisualAppearance();
	var_Appearance->Add(1,"c:\\exontrol\\images\\normal.ebn");
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("1/1/2008");
	var_Chart->PutMarkTodayColor(var_Chart->GetBackColor());
	var_Chart->PutLevelCount(2);
	var_Chart->PutMarkSelectDateColor(0x1000000);
	var_Chart->PutSelectLevel(1);
	var_Chart->PutSelectDate("1/3/2008",VARIANT_TRUE);
	var_Chart->PutSelectDate("1/4/2008",VARIANT_TRUE);
spG2antt1->GetColumns()->Add(L"Default");
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->AddBar(var_Items->AddItem("Item 1"),"Task","1/2/2008","1/6/2008",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->AddItem("Item 2"),"Task","1/3/2008","1/7/2008",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->AddItem("Item 3"),"Task","1/4/2008","1/8/2008",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->AddItem("Item 4"),"Task","1/5/2008","1/9/2008",vtMissing,vtMissing);
spG2antt1->EndUpdate();
The following C# sample shows how you can use skin / ebn files to display the selected dates:
axG2antt1.BeginUpdate();
EXG2ANTTLib.Appearance var_Appearance = axG2antt1.VisualAppearance;
	var_Appearance.Add(1,"c:\\exontrol\\images\\normal.ebn");
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = "1/1/2008";
	var_Chart.MarkTodayColor = var_Chart.BackColor;
	var_Chart.LevelCount = 2;
	var_Chart.MarkSelectDateColor = 0x1000000;
	var_Chart.SelectLevel = 1;
	var_Chart.set_SelectDate("1/3/2008",true);
	var_Chart.set_SelectDate("1/4/2008",true);
axG2antt1.Columns.Add("Default");
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AddBar(var_Items.AddItem("Item 1"),"Task","1/2/2008","1/6/2008",null,null);
	var_Items.AddBar(var_Items.AddItem("Item 2"),"Task","1/3/2008","1/7/2008",null,null);
	var_Items.AddBar(var_Items.AddItem("Item 3"),"Task","1/4/2008","1/8/2008",null,null);
	var_Items.AddBar(var_Items.AddItem("Item 4"),"Task","1/5/2008","1/9/2008",null,null);
axG2antt1.EndUpdate();
The following VFP sample shows how you can use skin / ebn files to display the selected dates:
with thisform.G2antt1
	.BeginUpdate
	with .VisualAppearance
		.Add(1,"c:\exontrol\images\normal.ebn")
	endwith
	with .Chart
		.FirstVisibleDate = {^2008-1-1}
		.MarkTodayColor = .BackColor
		.LevelCount = 2
		.MarkSelectDateColor = 0x1000000
		.SelectLevel = 1
		.SelectDate({^2008-1-3}) = .T.
		.SelectDate({^2008-1-4}) = .T.
	endwith
	.Columns.Add("Default")
	with .Items
		.AddBar(.AddItem("Item 1"),"Task",{^2008-1-2},{^2008-1-6})
		.AddBar(.AddItem("Item 2"),"Task",{^2008-1-3},{^2008-1-7})
		.AddBar(.AddItem("Item 3"),"Task",{^2008-1-4},{^2008-1-8})
		.AddBar(.AddItem("Item 4"),"Task",{^2008-1-5},{^2008-1-9})
	endwith
	.EndUpdate
endwith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.