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 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