Skip to content

ht Property

Description

Returns the specific part of the GridControl at a given X and Y coordinate.

Property Type

Read-only property

Syntax (Visual Basic)

Public Property ht() As [XTPGridHitTestInfoCode](XtremeGridControl~Enumerations~XTPGridHitTestInfoCode_EN.md)

Remarks

This can be very useful in mouse events to determine what part of the GridControl the mouse is positioned over for a particular event.

Example

HitTest Ht Sample (Visual Basic)

This sample illustrates how to determine which part of the GridControl, if any, occupies any given pixel.

Private Sub wndGridControl_MouseDown(Button As Integer, Shift As Integer, X As Long, Y As Long)

    ' Determines which part of the GridControl the mouse was positioned over when clicked.  
    Select Case wndGridControl.HitTest(X, Y).ht  

        ' If MouseDown while positioned anywhere over the Group Box (Even over Column Headers in Group Box)  
        Case xtpHitTestGroupBox:  
            Debug.Print "MouseDown in Group Box"  

        ' If MouseDown while positioned anywhere over the ColumnHeader area. This does NOT include  
        ' column header in the Group Box  
        Case xtpHitTestHeader:  
            Debug.Print "MouseDown in Column Header Area (Not in Group Box)"  

        ' If MouseDown while positioned over the Grid Area, this would include rows, columns, items, group rows, expand buttons  
        Case xtpHitTestGridArea:  
            Debug.Print "MouseDown in Grid Area"  

        ' This case will never happen, Unknown is returned when HitTest is called and the mouse is positioned  
        ' over an area outside of the Grid control  
        Case xtpHitTestUnknown:  
            Debug.Print "Mouse is in an Unknown Area"  

    End Select  

End Sub

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.