windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-calchitinfo-x28-system-dot-drawing-dot-point-x29.md
Returns information on the grid elements located at the specified point.
Namespace : DevExpress.XtraPivotGrid
Assembly : DevExpress.XtraPivotGrid.v25.2.dll
NuGet Package : DevExpress.Win.PivotGrid
public PivotGridHitInfo CalcHitInfo(
Point hitPoint
)
Public Function CalcHitInfo(
hitPoint As Point
) As PivotGridHitInfo
| Name | Type | Description |
|---|---|---|
| hitPoint | Point |
A Point structure which specifies the test point coordinates relative to the Pivot Grid Control’s top-left corner.
|
| Type | Description |
|---|---|
| PivotGridHitInfo |
A PivotGridHitInfo object which contains information about the grid elements located at the test point.
|
Use the CalcHitInfo method to determine which element is located at the specified point. For instance, this can be used when handling the Pivot Grid Control’s Click event to determine which element was clicked. In such cases, pass the current mouse pointer’s coordinates as the method’s parameter.
The following code snippets (auto-collected from DevExpress Examples) contain references to the CalcHitInfo(Point) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-pivot-grid-draw-a-custom-element-on-mouse-hover/CS/WindowsApplication73/Form1.cs#L61
mousePos = Point.Empty;
PivotGridHitInfo info = pivotGridControl1.CalcHitInfo(e.Location);
if (info.HitTest == PivotGridHitTest.Value)
private void pivotGridControl1_MouseClick(object sender, MouseEventArgs e) {
PivotGridHitInfo hitInfo = pivotGridControl1.CalcHitInfo(e.Location);
if (hitInfo.HitTest == PivotGridHitTest.Value && hitInfo.ValueInfo != null)
win-designer-pivot-as-master-filter/CS/DesignerSample/Form1.cs#L37
PivotGridControl pivot = sender as PivotGridControl;
PivotGridHitInfo hi = pivot.CalcHitInfo(e.Location);
skipFiltering = (hi.ValueInfo != null && hi.ValueInfo.ValueHitTest == PivotGridValueHitTest.ExpandButton);
winforms-pivot-grid-draw-a-custom-element-on-mouse-hover/VB/WindowsApplication73/Form1.vb#L59
mousePos = Point.Empty
Dim info As PivotGridHitInfo = pivotGridControl1.CalcHitInfo(e.Location)
If info.HitTest = PivotGridHitTest.Value Then
Private Sub pivotGridControl1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim hitInfo As PivotGridHitInfo = pivotGridControl1.CalcHitInfo(e.Location)
If hitInfo.HitTest = PivotGridHitTest.Value AndAlso hitInfo.ValueInfo IsNot Nothing Then dataGridView1.DataSource = hitInfo.ValueInfo.CreateDrillDownDataSource()
win-designer-pivot-as-master-filter/VB/DesignerSample/Form1.vb#L39
Dim pivot As PivotGridControl = TryCast(sender, PivotGridControl)
Dim hi As PivotGridHitInfo = pivot.CalcHitInfo(e.Location)
skipFiltering = (hi.ValueInfo IsNot Nothing AndAlso hi.ValueInfo.ValueHitTest = PivotGridValueHitTest.ExpandButton)
See Also