Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Data Binding
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Collapse]Hit Information
     Hit Information Overview
     Samples of Using Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Hit Information Overview

Expanded Online Video

In this video, you will learn how to obtain hit information. First, you will display tooltips indicating which element is currently under the mouse cursor. Then, you will use hit information to implement custom filtering UI.

Expanded Hit Information Overview

Sometimes you may need to recognize which element is located at the specified screen coordinates in applications. For instance, you may have to determine which part of a View the user has clicked or double-clicked. For this purpose, each View type implements the CalcHitInfo method. It accepts a specific point measured in grid control client coordinates as its pt parameter and returns the newly created hit info object containing information on a View's corresponding element.

Note that different View types have corresponding types of such hit info objects. So, the GridHitInfo object type holds information about a point hit-tested within a Grid View, a CardHitInfo object is Card View specific and the BandedGridHitInfo type corresponds to a banded View. All these types are derived from the BaseHitInfo class, which is the base one for hit info objects.

The image below shows the hit info objects' inheritance hierarchy.

Any hit info object exposes information about a tested point via a number of its properties that can be grouped into four logical categories:

  • properties identifying a View element that contains a test point (for instance, the Band, Column, RowHandle properties identify the band, column and row whose elements are under the test point);
TypeMembers
CardHitInfoCardHitInfo.Column, CardHitInfo.RowHandle
GridHitInfoGridHitInfo.Column, DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo.RowHandle
BandedGridHitInfoBandedGridHitInfo.Band, BandedGridHitInfo.Column, DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo.RowHandle
  • properties indicating whether or not a test point resides over a particular View element (for instance, the InCard, InColumnPanel property indicates whether the test point is over a card and a column panel);
  • the BaseHitInfo.HitPoint property representing a test point in coordinates relative to a grid's top-left corner;
  • the HitTest property identifying the type of element located under a test point.
TypeMember
CardHitInfo CardHitInfo.HitTest (returns one of the CardHitTest enumerator members)
GridHitInfo GridHitInfo.HitTest (returns one of the GridHitTest enumerator members)
BandedGridHitInfo BandedGridHitInfo.HitTest (returns one of the BandedGridHitTest enumerator members)

In some cases you may need to find out which View is located at specified screen coordinates. For this purpose you can use the GridControl.GetViewAt method.

Expanded Example

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 moving over a Grid Control with the mouse. The name of the current View element is displayed in the form's caption.

Expanded See Also

How would you rate this topic?​​​​​​​