property Chart.DateFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS) as Date
Retrieves the date from the cursor.

 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.  
   Date A Date expression that indicates the date from the cursor.  
The DateFromPoint property gets the date from 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 LevelFromPoint property to retrieve the index of the level from the cursor.

The following VB sample displays the date from the cursor:

Private Sub Gantt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With Gantt1.Chart
        Dim d As Date
        d = .DateFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY)
        Debug.Print .FormatDate(d, "<%m%>/<%d%>/<%yyyy%>")
    End With
End Sub

The following C++ sample displays the date from the point:

void OnMouseMoveGantt1(short Button, short Shift, long X, long Y) 
{
	CChart chart = m_gantt.GetChart();
	DATE d = chart.GetDateFromPoint( X, Y );
	CString strFormat = chart.GetFormatDate( d, "<%m%>/<%d%>/<%yyyy%>" );
	OutputDebugString( strFormat );
}

The following VB.NET sample displays the date from the point:

Private Sub AxGantt1_MouseMoveEvent(ByVal sender As Object, ByVal e As AxEXGANTTLib._IGanttEvents_MouseMoveEvent) Handles AxGantt1.MouseMoveEvent
    With AxGantt1.Chart
        Dim d As Date
        d = .DateFromPoint(e.x, e.y)
        Debug.Write(.FormatDate(d, "<%m%>/<%d%>/<%yyyy%>"))
    End With
End Sub

The following C# sample displays the date from the point:

private void axGantt1_MouseMoveEvent(object sender, AxEXGANTTLib._IGanttEvents_MouseMoveEvent e)
{
	DateTime d = axGantt1.Chart.get_DateFromPoint(e.x, e.y);
	System.Diagnostics.Debug.Write(axGantt1.Chart.get_FormatDate(d, "<%m%>/<%d%>/<%yyyy%>"));
}

The following VFP sample displays the date from the point:

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

with thisform.Gantt1.Chart
	d = .DateFromPoint(x,y)
	wait window nowait .FormatDate(d, "<%m%>/<%d%>/<%yyyy%>" )
endwith


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