

| Type | Description | |||
| BarKey as Variant | A Variant expression that holds the key of the bar to look for. | |||
| StartIndex as Variant |
A Long expression that could be one of the following:
| |||
| HITEM | A Long expression that specifies the handle of the item that hosts the specified bar. If 0, the FindBar found no item that hosts a bar with specified key. |
The following VB sample ensures that specified bar fits the control's chart area ( for the /COM version ):
Private Sub ensureVisibleBar(BarKey)
With G2antt1
.BeginUpdate
With .Items
Dim h As HITEM
h = .FindBar(BarKey)
If (h <> 0) Then
.EnsureVisibleItem h
G2antt1.Chart.ScrollTo .ItemBar(h, BarKey, exBarStart), AlignmentEnum.CenterAlignment
End If
End With
.EndUpdate
End With
End Sub
The following VB/NET sample ensures that the specified bar fits the control's chart area ( the code is for the /NET Assembly version ):
Private Sub ensureVisibleBar(ByVal BarKey)
With Exg2antt1
With .Items
Dim h As Integer = .get_FindBar(BarKey)
If (h <> 0) Then
Exg2antt1.BeginUpdate()
.EnsureVisibleItem(h)
Exg2antt1.Chart.ScrollTo(.get_BarStart(h, BarKey), exontrol.EXG2ANTTLib.AlignmentEnum.CenterAlignment)
Exg2antt1.EndUpdate()
End If
End With
End With
End Sub
The following C# sample ensures that the specified bar fits the control's chart area ( the code is for the /NET Assembly version ):
private void ensureVisibleBar(object barKey)
{
int h = exg2antt1.Items.get_FindBar(barKey);
if (h != 0)
{
exg2antt1.BeginUpdate();
exg2antt1.Items.EnsureVisibleItem(h);
exg2antt1.Chart.ScrollTo(exg2antt1.Items.get_BarStart(h, barKey), exontrol.EXG2ANTTLib.AlignmentEnum.CenterAlignment);
exg2antt1.EndUpdate();
}
}