How to: Determine the Document Element under the Mouse Pointer
- 3 minutes to read
The following code example shows how to use the HitTestManager.HitTest method to get information about the element under the mouse pointer. The method returns the RichEditHitTestResult instance containing an information about the layout element (RichEditHitTestResult.LayoutElement) under the test point. It allows you to get the element's type (LayoutElement.Type) and the area it occupies in the document (LayoutElement.Bounds).
In this example, the ToolTip instance is used to display the retrieved information. Perform hit testing and pass the information to the tooltip content in the RichEditControl.MouseMove event handler, as shown below:
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-show-a-tooltip-containing-information-about-the-document-layout-element-located-und-t602032.