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 or 0 if no date found.  
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 BarFromPoint property to get the bar from the point. Use the LinkFromPoint property to get the link from the point. Use the LevelFromPoint property to retrieve the index of the level from the cursor. 

The DateFromPoint property retrieves the value based on the X and Y parameters as follows:

The following VB sample displays the date from the cursor:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    With G2antt1.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 OnMouseMoveG2antt1(short Button, short Shift, long X, long Y) 
{
	CChart chart = m_g2antt.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 AxG2antt1_MouseMoveEvent(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_MouseMoveEvent) Handles AxG2antt1.MouseMoveEvent
    With AxG2antt1.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 axG2antt1_MouseMoveEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_MouseMoveEvent e)
{
	DateTime d = axG2antt1.Chart.get_DateFromPoint(e.x, e.y);
	System.Diagnostics.Debug.Write(axG2antt1.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.G2antt1.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.