property Chart.ItemBackColor(Item as HITEM) as Color
Retrieves or sets a background color for a specific item, in the chart area.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item.  
   Color A color expression that indicates the item's background color. The last 7 bits in the high significant byte of the color to indicates the identifier of the skin being used. Use the Add method to add new skins to the control. If you need to remove the skin appearance from a part of the control you need to reset the last 7 bits in the high significant byte of the color being applied to the  
By default, the ItemBackColor property is the same as Chart's BackColor property. The ItemBackColor property specifies the background or the visual appearance for the item's background on the chart area. The ItemBackColor property specifies the item's background color for the list area ( columns part of the control ). The ClearItemBackColor method clears the item's background on the chart part of the control.

The following screen shot shows the chart part when using the ItemBackColor property of the Chart object:

The following samples changes the background color for the item in the chart part only.

VBA (MS Access, Excell...)

With G2antt1
	.Columns.Add "Default"
	With .Items
		h = .AddItem("Root")
		hC = .InsertItem(h,0,"Child 1")
		G2antt1.Chart.ItemBackColor(hC) = RGB(255,0,0)
		.InsertItem h,0,"Child 2"
		.ExpandItem(h) = True
	End With
End With

VB6

With G2antt1
	.Columns.Add "Default"
	With .Items
		h = .AddItem("Root")
		hC = .InsertItem(h,0,"Child 1")
		G2antt1.Chart.ItemBackColor(hC) = RGB(255,0,0)
		.InsertItem h,0,"Child 2"
		.ExpandItem(h) = True
	End With
End With

VB.NET

Dim h,hC
With Exg2antt1
	.Columns.Add("Default")
	With .Items
		h = .AddItem("Root")
		hC = .InsertItem(h,0,"Child 1")
		Exg2antt1.Chart.set_ItemBackColor(hC,Color.FromArgb(255,0,0))
		.InsertItem(h,0,"Child 2")
		.set_ExpandItem(h,True)
	End With
End With

VB.NET for /COM

Dim h,hC
With AxG2antt1
	.Columns.Add("Default")
	With .Items
		h = .AddItem("Root")
		hC = .InsertItem(h,0,"Child 1")
		AxG2antt1.Chart.ItemBackColor(hC) = RGB(255,0,0)
		.InsertItem(h,0,"Child 2")
		.ExpandItem(h) = True
	End With
End With

C++

/*
	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->GetColumns()->Add(L"Default");
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	long h = var_Items->AddItem("Root");
	long hC = var_Items->InsertItem(h,long(0),"Child 1");
	spG2antt1->GetChart()->PutItemBackColor(hC,RGB(255,0,0));
	var_Items->InsertItem(h,long(0),"Child 2");
	var_Items->PutExpandItem(h,VARIANT_TRUE);

C#

exg2antt1.Columns.Add("Default");
exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items;
	int h = var_Items.AddItem("Root");
	int hC = var_Items.InsertItem(h,0,"Child 1");
	exg2antt1.Chart.set_ItemBackColor(hC,Color.FromArgb(255,0,0));
	var_Items.InsertItem(h,0,"Child 2");
	var_Items.set_ExpandItem(h,true);

C# for /COM

axG2antt1.Columns.Add("Default");
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	int h = var_Items.AddItem("Root");
	int hC = var_Items.InsertItem(h,0,"Child 1");
	axG2antt1.Chart.set_ItemBackColor(hC,(uint)ColorTranslator.ToWin32(Color.FromArgb(255,0,0)));
	var_Items.InsertItem(h,0,"Child 2");
	var_Items.set_ExpandItem(h,true);

Delphi 8 (.NET only)

with AxG2antt1 do
begin
	Columns.Add('Default');
	with Items do
	begin
		h := AddItem('Root');
		hC := InsertItem(h,TObject(0),'Child 1');
		AxG2antt1.Chart.ItemBackColor[hC] := $ff;
		InsertItem(h,TObject(0),'Child 2');
		ExpandItem[h] := True;
	end;
end

Delphi (standard)

with G2antt1 do
begin
	Columns.Add('Default');
	with Items do
	begin
		h := AddItem('Root');
		hC := InsertItem(h,OleVariant(0),'Child 1');
		G2antt1.Chart.ItemBackColor[hC] := $ff;
		InsertItem(h,OleVariant(0),'Child 2');
		ExpandItem[h] := True;
	end;
end

VFP

with thisform.G2antt1
	.Columns.Add("Default")
	with .Items
		h = .AddItem("Root")
		hC = .InsertItem(h,0,"Child 1")
		thisform.G2antt1.Chart.ItemBackColor(hC) = RGB(255,0,0)
		.InsertItem(h,0,"Child 2")
		.ExpandItem(h) = .T.
	endwith
endwith

 


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