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
  [Expand]Data Grid
  [Collapse]Vertical Grid
   [Expand]Overview
   [Expand]Fundamentals
   [Collapse]Concepts
     Filtering
    [Expand]Layouts
    [Expand]Binding to Data
    [Expand]Rows
    [Expand]Records
    [Expand]Cells
    [Expand]In-place Editors
     Formatting
    [Expand]Appearances
     Hit Information
    [Expand]Custom Painting
    [Expand]Alpha Blending and Background Images
    [Expand]Customization Form
     Batch Modifications
    [Expand]Drag and Drop
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [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

Sometimes in applications you may need to identify which element is located at specific coordinates. For instance, you may need to determine which part of a VGridControl control has been clicked or determine if dropping is allowed to a particular control's area when performing drag and drop operations.

For the purposes described above, use the grid control's VGridControlBase.CalcHitInfo method. It accepts a point in grid client coordinates as a parameter and returns a newly created VGridHitInfo object containing information on the grid's corresponding element. Note that you can also pass a point located outside the grid control. The coordinates should also be measured from the grid control's top left corner.

The returned VGridHitInfo object exposes information about the point passed via a number of its properties. Use the VGridHitInfo.BandIndex, VGridHitInfo.CellIndex and VGridHitInfo.RecordIndex properties to get the index of a band, cell or record which the specified point belongs to. If a row is at the point specified, you can determine which one it is by the VGridHitInfo.Row property. The VGridHitInfo.HitInfoType property can be used to get the type of an element residing under the test point. This property returns one of the VGridHitInfo enumeration values.

The following example demonstrates how to process information provided by the VGridHitInfo object. It handles the grid's System.Windows.Forms.Control.MouseMove event and displays information about a grid element under the mouse cursor. This example assumes that the form contains the VGridControl and System.Windows.Forms.ListBox controls.

The image below illustrates the sample application. Note that the multiple records view layout is applied to the grid control in this example (the grid's VGridControl.LayoutStyle property is set to LayoutViewStyle.MultiRecordView). In this layout the control is considered to have a single band. So the VGridHitInfo.BandIndex property always returns 0.

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