Skip to content

HitTest Method

Description

Determines the CommandBarGalleryItem at the specified coordinates.

Syntax

Public Function HitTest( _
    ByVal [x](#) As Long, _
    ByVal [y](#) As Long _
) As [CommandBarGalleryItem](XtremeCommandBars~CommandBarGalleryItem.md)

Parameters

  • x: X coordinate to test.
  • y: Y coordinate to test.

Return Type

Returns a CommandBarGalleryItem at the specified coordinates.

Remarks

HitTest is used to determine which CommandBarGalleryItem, if any, is at the specified coordinates. This can be used to determine which item was clicked or hovered over; however, the ItemClick event will also be fired when an item is clicked.

Example

Private Sub RecentFileListBox_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)  
    If (Button = vbRightButton) Then  
        Dim Item As CommandBarGalleryItem  
        Set Item = RecentFileListBox.HitTest(x, y)  

        If Not Item Is Nothing Then  
            Debug.Print Item.Caption  
        End If  
    End If  
End Sub

See Also


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