property Items.ItemBar(Item as HITEM, Key as Variant, Property as ItemBarPropertyEnum) as Variant
Gets or sets a bar property.

 TypeDescription 
   Item as HITEM A long expression that indicates the the handle of the item where the bar is removed. If the Item parameter is 0, it indicates all bars with specified key. In this case the DefaultItem property should be zero ( by default ), else it refers the  item being indicated by DefaultItem property.  
   Key as Variant Optional. A String expression that indicates the key of the bar being accessed. If missing, the Key parameter is empty. If the Item has only a single Bar you may not use the Key parameter, else an unique key ( in the same bars of the item ) should be used.  
   Property as ItemBarPropertyEnum An ItemBarPropertyEnum expression that indicates the property being accessed  
   Variant A Variant expression that indicates the property's value.  
Use the ItemBar property to access properties related to the bars being shown in the item. Use the AddBar property to add new bars to the item. Use the FirstVisibleDate property to specify the first visible date in the chart area. Use the RemoveBar method to remove a bar from an item. Use the ClearBars method to remove all bars in the item. Use the Refresh method to refresh the chart. For instance, you can use the ItemBar(,,exBarToolTip) property to specify a tooltip for a bar, or ItemBar(,,exBarItemParent) property to move the bar from an item to another item. The AllowCellValueToItemBar property allows the cells to display properties of the bars. Use the SelectOnClick property to disable selecting new items when the user clicks the chart area. The FindBar method looks for the item that hosts a specified bar. You can use the Def property to define the default values for bar's ItemBar properties.

Based on the values of Item and Key parameters the ItemBar property can change a property for one or multiple bars as follow: 

In any other case, the ItemBar changes the property for specified key.

The /NET Assembly version defines get/set shortcut properties as follow ( they start with get_ or set_ keywords ):

So instead using the get_ItemBar or set_ItemBar properties you can use these functions. 

For instance, the following VB/NET sample changes the bar's color:

With Exg2antt1.Items
    .set_BarColor(.FocusItem, .get_FirstItemBar(.FocusItem), Color.Red)
End With
 

The following VB sample changes the end date for the bar in the first visible item ( in this sample we consider that AddBar method was used with the Key parameter as being empty ) :

With G2antt1.Items
    .ItemBar(.FirstVisibleItem, "", exBarEnd) = "6/19/2005"
End With

The following C++ sample changes the end date for the bar in the first visible item:

CItems items = m_g2antt.GetItems();
items.SetItemBar( items.GetFirstVisibleItem(), COleVariant(""), 2 /*exBarEnd*/, COleVariant("6/19/2005") );

The following VB.NET sample changes the end date for the bar in the first visible item:

With AxG2antt1.Items
    .ItemBar(.FirstVisibleItem, "", EXG2ANTTLib.ItemBarPropertyEnum.exBarEnd) = "6/19/2005"
End With

The following C# sample changes the end date for the bar in the first visible item:

axG2antt1.Items.set_ItemBar(axG2antt1.Items.FirstVisibleItem, "", EXG2ANTTLib.ItemBarPropertyEnum.exBarEnd, "6/19/2005");

The following VFP sample changes the end date for the bar in the first visible item:

with thisform.G2antt1.Items
	.DefaultItem = .FirstVisibleItem
	thisform.G2antt1.Template = "Items.ItemBar(0,`" + _key + "`,2 ) = `20/07/2005`"
endwith

where the _key is the key of the bar being resized.

The VFP sample uses the Template property in order to execute the ItemBar property, else some version of VFP could fire "Function argument, value, type, or count is invalid". The sample builds the script:

Items.ItemBar(0,_key,2) = `20/07/2005`

This way the ItemBar property for the default item is invoked.


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