![]() | Type | Description | ||
| 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 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 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 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 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