property Chart.LevelFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS) as Long
Retrieves the index of the level from the 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.  
   Long A long expression that indicates the index of the level from the point, or -1 if the  cursor is not in the chart's header.  
The LevelFromPoint property gets the level from the point. Use the Level property to access a Level object. The LevelCount property counts the number of the levels in the chart's header. Use the ItemFromPoint property to get the cell/item from the cursor. Use the ColumnFromPoint property to retrieve the column from cursor. Use the BarFromPoint property to get the bar from the point. Use the LinkFromPoint property to get the link from the point. If the X parameter is -1 and Y parameter is -1 the ItemFromPoint property determines the handle of the item from the cursor.

The following VB sample displays the label of the level  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 Long
        d = .LevelFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY)
        If d >= 0 Then
            Debug.Print .Level(d).Label
        End If
    End With
End Sub

The following C++ sample displays the label of the level from the point:

void OnMouseMoveG2antt1(short Button, short Shift, long X, long Y) 
{
	CChart chart = m_g2antt.GetChart();
	long d = chart.GetLevelFromPoint( X, Y );
	if ( d >= 0 )
		OutputDebugString( V2S( &chart.GetLevel(d).GetLabel() ) );
}

The following VB.NET sample displays the label of the level 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 Integer = .LevelFromPoint(e.x, e.y)
        If (d >= 0) Then
            Debug.Write(.Level(d).Label)
        End If
    End With
End Sub

The following C# sample displays the label of the level from the point:

private void axG2antt1_MouseMoveEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_MouseMoveEvent e)
{
    int d = axG2antt1.Chart.get_LevelFromPoint(e.x, e.y);
    if ( d >=0 ) 
        System.Diagnostics.Debug.Write(axG2antt1.Chart.get_Level(d).Label );
}

The following VFP sample displays the label of the level from the point:

*** ActiveX Control Event ***
*** ActiveX Control Event ***

LPARAMETERS button, shift, x, y

with thisform.G2antt1.Chart
	d = .LevelFromPoint(x,y)
	if ( d>=0 )
		wait window nowait .Level(d).Label
	endif
endwith

 


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