VGridHitInfo Class
Contains information about a point referenced by specified coordinates.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
Declaration
Related API Members
The following members return VGridHitInfo objects:
Remarks
The VGridHitInfo represents a class containing information about objects located at a specified point. The VGridHitInfo object is created by invoking the VGridControlBase.CalcHitInfo method of the VGridControl. This method requires the test point as a parameter. You can use the VGridHitInfo.HitInfoType property of the obtained object to get the type of element residing under the test point. This property returns one of the HitInfoTypeEnum enumeration values.
Example
The sample code below assumes that the application form has instances of the VGridControl and ListBox controls placed on it. The code is a handler for the MouseMove event of the vertical grid control. The handler obtains information about a point under the mouse cursor and outputs basic point characteristics as the text of the ListBox control.
Note that the point coordinates should be specified relative to the vertical grid control in order for the VGridControlBase.CalcHitInfo method to return a correctly composed VGridHitInfo
object.
When this example runs, you can move the mouse cursor over the vertical grid control and identify which part of the grid is currently under the cursor. If you press a mouse button anywhere inside the grid’s client area and then move the cursor out of the grid while holding the button pressed, you can see how outlying points are defined by properties of a VGridHitInfo
object.
using DevExpress.XtraVerticalGrid;
private void vGridControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) {
Point pt = new Point(e.X, e.Y);
// obtaining information about a point at the specified coordinates
VGridHitInfo hitInfo = vGridControl1.CalcHitInfo(pt);
listBox1.Items.Clear();
// displaying specific characteristics defined a point under the mouse cursor
listBox1.Items.Add("BandIndex: " + hitInfo.BandIndex);
listBox1.Items.Add("CellIndex: " + hitInfo.CellIndex);
listBox1.Items.Add("PtMouse: " + hitInfo.PtMouse);
listBox1.Items.Add("RecordIndex: " + hitInfo.RecordIndex);
listBox1.Items.Add("HitInfoType: " + hitInfo.HitInfoType);
}