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 FormateDate property to format a date. Use the DrawDateTicker property to draw a ticker as cursor hovers the chart's area. Use the LinkFromPoint property to get the link from the point.

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

Private Sub Gantt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With Gantt1.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 Gantt1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With Gantt1
        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 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 OnMouseDownGantt1(short Button, short Shift, long X, long Y) 
{
	long c = 0, hit = 0, h = m_gantt.GetItemFromPoint( -1, -1, &c, &hit );
	if ( h != 0 )
	{
		COleVariant vtKey = m_gantt.GetChart().GetBarFromPoint( -1, -1 );
		if ( V_VT( &vtKey ) != VT_EMPTY )
		{
			COleVariant vtStart = m_gantt.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 AxGantt1_MouseDownEvent(ByVal sender As Object, ByVal e As AxEXGANTTLib._IGanttEvents_MouseDownEvent) Handles AxGantt1.MouseDownEvent
    With AxGantt1
        Dim c As Long, hit As EXGANTTLib.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, EXGANTTLib.ItemBarPropertyEnum.exBarStart))
            End If
        End If
    End With
End Sub

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

private void axGantt1_MouseDownEvent(object sender, AxEXGANTTLib._IGanttEvents_MouseDownEvent e)
{
	int c = 0;
	EXGANTTLib.HitTestInfoEnum hit = EXGANTTLib.HitTestInfoEnum.exHTCell;
	int h = axGantt1.get_ItemFromPoint(-1, -1, out c, out hit);
	if (h != 0)
	{
		object k = axGantt1.Chart.get_BarFromPoint(-1, -1);
		if (k != null)
			System.Diagnostics.Debug.WriteLine( axGantt1.Items.get_ItemBar( h, k, EXGANTTLib.ItemBarPropertyEnum.exBarStart ) );
	}
}

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

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

With thisform.Gantt1
	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