windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-viewinfo-b582a4a6.md
Lists values identifying a Grid View’s visual elements.
Namespace : DevExpress.XtraGrid.Views.Grid.ViewInfo
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
public enum GridHitTest
Public Enum GridHitTest
| Name | Description |
|---|---|
None |
The test point does not belong to any View visual element or is outside the View.
|
| Column |
The test point belongs to a column header.
|
| ColumnEdge |
The test point belongs to the right edge of a column header. End-users can drag these edges to resize columns horizontally (the desired column’s OptionsColumn.AllowSize option must be enabled for this purpose).
|
| ColumnButton |
The test point belongs to the header panel button.
|
| ColumnFilterButton |
The test point belongs to a filter button.
|
| ColumnPanel |
The test point belongs to the column header panel’s area not occupied by column headers.
|
| ColumnHeaderSearchButton |
The test point belongs to the search button in a column header.
|
| ColumnHeaderSearchText |
The test point belongs to the search text in a column header.
|
| RowCell |
The test point belongs to a row cell.
|
| RowIndicator |
The test point belongs to an indicator panel cell corresponding to a data row or group row.
|
| RowGroupButton |
The test point belongs to a group expand button.
|
| RowGroupCheckSelector |
The test point belongs to a Group Row Check Box Selector.
|
| Row |
The test point belongs to either a group row or a data row’s area not occupied by data cells.
|
| RowPreview |
The test point belongs to a preview section.
|
| RowDetail |
The test point belongs to a detail section.
|
| RowDetailEdge |
The test point belongs to the detail section’s bottom edge. The edge can be dragged to resize the detail section vertically.
|
| RowDetailIndicator |
The test point belongs to an indicator panel cell corresponding to a detail section.
|
| EmptyRow |
The test point is below all rows.
|
| GroupPanel |
The test point belongs to the group panel.
|
| GroupPanelColumn |
The test point belongs to a column header displayed within the group panel.
|
| GroupPanelColumnFilterButton |
The test point belongs to the filter button displayed by a column header that resides within the group panel.
|
| GroupPanelColumnHeaderSearchButton |
The test point belongs to the search button in a grouped column header.
|
| GroupPanelColumnHeaderSearchText |
The test point belongs to the search text in a grouped column header.
|
| GroupPanelFindPanelButton |
The test point belongs to the Find button in the group panel.
|
| Footer |
The test point belongs to the view footer.
|
| CellButton |
The test point belongs to a master-detail expand button which can be used to open/close details.
|
| CustomizationForm |
The test point belongs to the Customization Form.
|
| FilterPanel |
The test point belongs to the filter panel.
|
| FilterPanelCloseButton |
The test point belongs to the filter close button.
|
| RowFooter |
The test point belongs to a group footer.
|
| RowEdge |
The test point belongs to the bottom edge of a data row. The edge can be dragged to resize the row vertically (if the GridOptionsCustomization.AllowRowSizing option is active).
|
| FixedLeftDiv |
The test point belongs to the left fixed line.
|
| FixedRightDiv |
The test point belongs to the right fixed line.
|
| VScrollBar |
The test point belongs to the View’s vertical scroll bar.
|
| HScrollBar |
The test point belongs to the View’s horizontal scroll bar.
|
| FilterPanelActiveButton |
The test point belongs to the button in the filter panel used to activate filtering within a View.
|
| FilterPanelText |
The test point belongs to a string in the filter panel which represents the filter criteria applied to a View.
|
| FilterPanelMRUButton |
The test point belongs to the button in the filter panel used to display a dropdown window with a list of the most recently used filter criteria.
|
| FilterPanelCustomizeButton |
The test point belongs to the filter panel customize button.
|
| ViewCaption |
The test point belongs to the View Caption.
|
| MasterTabPageHeader |
The test point belongs to the View’s master-detail tab.
|
| RowGroupCell |
The test point belongs to a row group cell.
|
The following properties accept/return GridHitTest values:
GridHitTest enumeration values are returned by the GridHitInfo.HitTestproperty of a GridHitInfo object. GridHitInfo objects can be created by calling the Grid View’s GridView.CalcHitInfo method.
The following images illustrate some visual elements and corresponding enumeration values. For a complete list of enumeration values, see the table below.
The following sample code shows how to identify the element located at a specific point using the GridView.CalcHitInfo method.
In the example, the CalcHitInfo method is called when you move the cursor over a Grid Control. The name of the current View element is displayed in the form’s caption.
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Base.ViewInfo;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
// ...
private void gridControl1_MouseMove(object sender, MouseEventArgs e) {
GridControl grid = sender as GridControl;
if (grid == null) return;
// Get a View at the current point.
BaseView view = grid.GetViewAt(e.Location);
if (view == null) return;
// Retrieve information on the current View element.
BaseHitInfo baseHI = view.CalcHitInfo(e.Location);
GridHitInfo gridHI = baseHI as GridHitInfo;
if (gridHI != null)
Text = gridHI.HitTest.ToString();
}
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Base.ViewInfo
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
' ...
Private Sub GridControl1_MouseMove(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles GridControl1.MouseMove
Dim grid As GridControl = sender
If grid Is Nothing Then
Return
End If
' Get a View at the current point.
Dim view As BaseView = grid.GetViewAt(e.Location)
If view Is Nothing Then
Return
End If
' Retrieve information on the current View element.
Dim baseHI As BaseHitInfo = view.CalcHitInfo(e.Location)
Dim gridHI As GridHitInfo = TryCast(baseHI, GridHitInfo)
If Not gridHI Is Nothing Then
Text = gridHI.HitTest.ToString()
End If
End Sub
See Also