[]
        
(Showing Draft Content)

C1.Win.FlexGrid.C1FlexGridBase.HitTest

HitTest Method

HitTest(int, int)

Returns information about the control at a specified point on the control surface.

Declaration
public HitTestInfo HitTest(int x, int y)
Parameters
Type Name Description
int x

The horizontal position of the client coordinate.

int y

The vertical position of the client coordinate.

Returns
Type Description
HitTestInfo

A HitTestInfo object that contains information about the point.

Remarks

This method is especially useful when handling the BeforeMouseDown event. It allows you to determine whether the mouse is over a specific cell, grid buttons, resizing elements, etc.

Examples

The code below shows hit test information whenever the user clicks the mouse:

void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
{
  HitTestInfo hti = _flex.HitTest(e.X, e.Y);
  Console.WriteLine("at {0},{1}: row {2} col {3} type {4}",
                     hti.X, hti.Y, hti.Row, hti.Column, hti.Type);
}

HitTest(Point)

Returns information about the control at a specified point on the control surface.

Declaration
public HitTestInfo HitTest(Point pt)
Parameters
Type Name Description
Point pt

Point in client coordinates.

Returns
Type Description
HitTestInfo

A HitTestInfo object that contains information about the point.

Remarks

This method is especially useful when handling the BeforeMouseDown event. It allows you to determine whether the mouse is over a specific cell, grid buttons, resizing elements, etc.

HitTest()

Returns information about the control at the current mouse position.

Declaration
public HitTestInfo HitTest()
Returns
Type Description
HitTestInfo

A HitTestInfo object that contains information about the point.