property Chart.BarFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS) as Variant
Retrieves the bar from point.

TypeDescription
X as OLE_XPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates.
Y as OLE_YPOS_PIXELS A single that specifies the current Y location of the mouse pointer. The y values is always expressed in client coordinates.
Variant A VARIANT expression that indicates the key of the bar from the cursor.
The BarFromPoint property gets the bar from point. If the X parameter is -1 and Y parameter is -1 the BarFromPoint property determines the key of the bar from the cursor. Use the ItemBar property to access properties of the bar from the point. The DateFromPoint property retrieves the date from the cursor, only if the cursor hovers the chart's area. Use the ItemFromPoint property to get the cell/item from the cursor. Use the ColumnFromPoint property to retrieve the column from cursor. Use the LinkFromPoint property to get the link from the point.  Use the FormateDate property to format a date. Use the DrawDateTicker property to draw a ticker as cursor hovers the chart's area. Use the LevelFromPoint property to retrieve the index of the level from the cursor. The ItemBar(exBarSelectable) property specifies whether a bar is selectable or not. The BarFromPoint property can returns only selectable bars. By default, all bars are selectable. The NoteFromPoint property retrieves the note/box from the cursor.

The following VB sample displays the handle of the item and the key of the bar from cursor:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim h As HITEM, c As Long, hit As HitTestInfoEnum
    With G2antt1
        h = .ItemFromPoint(-1, -1, c, hit)
        If (h <> 0) Then
            Dim k As Variant
            k = .Chart.BarFromPoint(-1, -1)
            If Not IsEmpty(k) Then
                Debug.Print h & " " & k
            End If
        End If
    End With
End Sub

The following Access sample displays the handle of the item and the key of the bar from cursor ( please notice that the X and Y parameters of the MouseMove event are declared as Long ):

Private Sub G2antt1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
    Dim h As HITEM, c As Long, hit As HitTestInfoEnum
    With G2antt1
        h = .ItemFromPoint(-1, -1, c, hit)
        If (h <> 0) Then
            Dim k As Variant
            k = .Chart.BarFromPoint(-1, -1)
            If Not IsEmpty(k) Then
                Debug.Print h & " " & k
            End If
        End If
    End With
End Sub

or:

Private Sub G2antt1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Long, ByVal Y As Long)
    Dim h As Long, c As Long, hit As Long
    With G2antt1
        h = .ItemFromPoint(-1, -1, c, hit)
        If (h <> 0) Then
            Dim k As Variant
            k = .Chart.BarFromPoint(-1, -1)
            If Not IsEmpty(k) Then
                MsgBox h & " " & k
            End If
        End If
    End With
End Sub

The second sample uses the Long type instead HITEM and HitTestInfoEnum which are equivalents.

The following VB sample displays the key of the bar from the cursor:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With G2antt1.Chart
        Debug.Print .BarFromPoint(-1, -1)
    End With
End Sub

The following VB sample displays the start data of the bar from the point:

Private Sub G2antt1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With G2antt1
        Dim h As HITEM, c As Long, hit As HitTestInfoEnum
        h = .ItemFromPoint(-1, -1, c, hit)
        If Not (h = 0) Then
            Dim k As Variant
            k = .Chart.BarFromPoint(-1, -1)
            If Not IsEmpty(k) Then
                Debug.Print .Items.ItemBar(h, k, exBarStart)
            End If
        End If
    End With
End Sub

The following VB sample displays the keys of the bars from the cursor ( in case several bars covers each other ):

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim h As HITEM, c As Long, hit As HitTestInfoEnum
    With G2antt1
        h = .ItemFromPoint(-1, -1, c, hit)
        
        If (h <> 0) Then
            Dim vKey As Variant, vKeys As New Collection
            
            vKey = .Chart.BarFromPoint(-1, -1)
            While (Not VarType(vKey) = vbEmpty)
                vKeys.Add vKey
                .Items.ItemBar(h, vKey, exBarSelectable) = False
                vKey = .Chart.BarFromPoint(-1, -1)
            Wend
            
            If (vKeys.Count > 0) Then
                Debug.Print "Bar(s) from the cursor: "
                Dim v As Variant
                For Each v In vKeys
                    .Items.ItemBar(h, v, exBarSelectable) = True
                    Debug.Print v
                Next
                Else
                Debug.Print "No bar at the cursor."
            End If
            
            Set vKeys = Nothing
        End If
    End With
End Sub

The following C++ sample displays the start data of the bar from the point:

#include "Items.h"
#include "Chart.h"

CString V2Date( VARIANT* pvtValue )
{
	COleVariant vtDate;
	vtDate.ChangeType( VT_BSTR, pvtValue );
	return V_BSTR( &vtDate );
}

void OnMouseDownG2antt1(short Button, short Shift, long X, long Y) 
{
	long c = 0, hit = 0, h = m_g2antt.GetItemFromPoint( -1, -1, &c, &hit );
	if ( h != 0 )
	{
		COleVariant vtKey = m_g2antt.GetChart().GetBarFromPoint( -1, -1 );
		if ( V_VT( &vtKey ) != VT_EMPTY )
		{
			COleVariant vtStart = m_g2antt.GetItems().GetItemBar( h, vtKey, 1 /*exBarStart*/ );
			OutputDebugString( V2Date( &vtStart ) );
		}
	}
}

The following VB.NET sample displays the start data of the bar from the point:

Private Sub AxG2antt1_MouseDownEvent(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_MouseDownEvent) Handles AxG2antt1.MouseDownEvent
    With AxG2antt1
        Dim c As Long, hit As EXG2ANTTLib.HitTestInfoEnum, h As Integer = .get_ItemFromPoint(-1, -1, c, hit)
        If Not (h = 0) Then
            Dim k As Object
            k = .Chart.BarFromPoint(-1, -1)
            If Not k Is Nothing Then
                System.Diagnostics.Debug.WriteLine(.Items.ItemBar(h, k, EXG2ANTTLib.ItemBarPropertyEnum.exBarStart))
            End If
        End If
    End With
End Sub

The following VB.NET /NET Assembly sample displays the bars from the point ( in case several bars covers each other ):

Private Sub Exg2antt1_MouseMoveEvent(ByVal sender As System.Object, ByVal Button As System.Int16, ByVal Shift As System.Int16, ByVal X As System.Int32, ByVal Y As System.Int32) Handles Exg2antt1.MouseMoveEvent
    With Exg2antt1
        Dim h As Integer = .get_ItemFromPoint(-1, -1)
        If (h <> 0) Then
            Dim vKey As Object = Exg2antt1.Chart.get_BarFromPoint(-1, -1)
            Dim vKeys As List(Of Object) = New List(Of Object)

            While Not vKey Is Nothing
                vKeys.Add(vKey)
                .Items.set_BarSelectable(h, vKey, False)
                vKey = .Chart.get_BarFromPoint(-1, -1)
            End While

            System.Diagnostics.Debug.Print("Bars from point: " + vKeys.Count.ToString())
            Dim v As Object
            For Each v In vKeys
                System.Diagnostics.Debug.Print(v.ToString())
                Exg2antt1.Items.set_BarSelectable(h, v, True)
            Next
        End If
    End With
End Sub

The following C# sample displays the start data of the bar from the point:

private void axG2antt1_MouseDownEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_MouseDownEvent e)
{
	int c = 0;
	EXG2ANTTLib.HitTestInfoEnum hit = EXG2ANTTLib.HitTestInfoEnum.exHTCell;
	int h = axG2antt1.get_ItemFromPoint(-1, -1, out c, out hit);
	if (h != 0)
	{
		object k = axG2antt1.Chart.get_BarFromPoint(-1, -1);
		if (k != null)
			System.Diagnostics.Debug.WriteLine( axG2antt1.Items.get_ItemBar( h, k, EXG2ANTTLib.ItemBarPropertyEnum.exBarStart ) );
	}
}

The following C# /NET Assembly sample displays the bars from the point ( in case several bars covers each other ):

private void exg2antt1_MouseMoveEvent(object sender, short Button, short Shift, int X, int Y)
{
    int h = exg2antt1.get_ItemFromPoint(-1, -1);
    if (h != 0)
    {
        object vKey = exg2antt1.Chart.get_BarFromPoint(-1, -1);
        List<object> vKeys = new List<object>();
        while (vKey != null)
        {
            vKeys.Add(vKey);
            exg2antt1.Items.set_BarSelectable(h, vKey, false);
            vKey = exg2antt1.Chart.get_BarFromPoint(-1, -1);
        }
        System.Diagnostics.Debug.Print("Bars from point: " + vKeys.Count.ToString());
        foreach (object v in vKeys)
        {
            System.Diagnostics.Debug.Print(v.ToString());
            exg2antt1.Items.set_BarSelectable(h, v, true);
        }
    }
}

The following VFP sample displays the start data of the bar from the point:

*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y

With thisform.G2antt1
	local h, c, hit
    h = .ItemFromPoint(-1, -1, c, hit)
    If (h # 0) Then
        local k
        k = .Chart.BarFromPoint(-1, -1)
        If !Empty(k) Then
            ? .Items.ItemBar(h, k, 1)
        EndIf
    EndIf
EndWith