Skip to main content

How to: Get the Type of an Element That Is Hovered Over

The following sample code represents a handler for the MouseMove event. It calculates hit information for the mouse pointer’s position via the NavBarControl.CalcHitInfo method. Then, the type of the element that is hovered over is assigned to a string variable.

private void navBarControl1_MouseMove(object sender, MouseEventArgs e) {
   // calculating hit information by the current mouse pointer position
   NavBarHitInfo hitInfo = navBarControl1.CalcHitInfo(new Point(e.X, e.Y));
   // obtaining the type of the element which is under the mouse pointer
   string element = hitInfo.HitTest.ToString();
   // ...
}