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 X location of the mouse pointer. The x values is always expressed in client coordinates | |||
Node as Node | A Node object where the cursor is. | |||
HitTestEnum | A HitTestEnum expression that indicates the location of the cursor relative to the control's client area. |
The following VB sample displays the hit test code while user moves the mouse:
Private Sub XMLGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) With XMLGrid1 Dim n As EXMLGRIDLibCtl.Node, h As EXMLGRIDLibCtl.HitTestEnum h = .HitTest(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, n) If Not h = 0 Then If (Not n Is Nothing) Then Debug.Print "Node = " & n.Name & " H = " & Hex(h) Else Debug.Print "H = " & Hex(h) End If End If End With End Sub
The following C++ sample displays the hit test code while user moves the mouse:
#include "Node.h" void OnMouseMoveXmlgrid1(short Button, short Shift, long X, long Y) { CNode node; node.m_bAutoRelease = FALSE; long nHitTest = m_xmlgrid.GetHitTest( X, Y, &node.m_lpDispatch ); if ( node.m_lpDispatch != NULL ) { CString strFormat; strFormat.Format( "HitTest = 0x%04X, '%s' ", nHitTest, node.GetName() ); OutputDebugString( strFormat ); } }
The following VB.NET sample displays the hit test code while user moves the mouse:
Private Sub AxXMLGrid1_MouseMoveEvent(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_MouseMoveEvent) Handles AxXMLGrid1.MouseMoveEvent With AxXMLGrid1 Dim node As EXMLGRIDLib.Node = Nothing Dim hitTest As EXMLGRIDLib.HitTestEnum = .get_HitTest(e.x, e.y, node) If Not node Is Nothing Then Dim strMessage As String = "HitTest = " & hitTest.ToString() & " '" & node.Name & "'" Debug.Write(strMessage) End If End With End Sub
The following C# sample displays the hit test code while user moves the mouse:
private void axXMLGrid1_MouseMoveEvent(object sender, AxEXMLGRIDLib._IXMLGridEvents_MouseMoveEvent e) { EXMLGRIDLib.Node node = null; EXMLGRIDLib.HitTestEnum hitTest = axXMLGrid1.get_HitTest(e.x, e.y, out node ); if (node != null) { String strMessage = "HitTest " + hitTest.ToString() + " '" + node.Name + "'"; System.Diagnostics.Debug.Write(strMessage); } }
The following VFP sample displays the hit test code while user moves the mouse:
*** ActiveX Control Event *** LPARAMETERS button, shift, x, y with thisform.XMLGrid1 local n, hitTest n = .SelectedNode(0) hitTest = .HitTest(x, y, @n ) if ( !isnull(n) ) wait window nowait "H:" + Str(hitTest) + " " + n.Name endif endwith