windowsforms-devexpress-dot-xtranavbar-dot-navbarcontrol-dot-calchitinfo-x28-system-dot-drawing-dot-point-x29.md
Gets an object containing information about the control at a specified point.
Namespace : DevExpress.XtraNavBar
Assembly : DevExpress.XtraNavBar.v25.2.dll
NuGet Package : DevExpress.Win
public virtual NavBarHitInfo CalcHitInfo(
Point p
)
Public Overridable Function CalcHitInfo(
p As Point
) As NavBarHitInfo
| Name | Type | Description |
|---|---|---|
| p | Point |
A System.Drawing.Point object specifying the examined point.
|
| Type | Description |
|---|---|
| NavBarHitInfo |
A NavBarHitInfo object providing information about the control’s specified point.
|
Use the CalcHitInfo method to determine control elements over which a specified point resides and obtain objects representing these elements. Review the NavBarHitInfo class description for more details on information it provides.
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();
// ...
}
Private Sub NavBarControl1_MouseMove(ByVal sender As Object, _
ByVal e As MouseEventArgs) Handles NavBarControl1.MouseMove
' calculating hit information by the current mouse pointer position
Dim HitInfo As NavBarHitInfo = NavBarControl1.CalcHitInfo(New Point(e.X, e.Y))
' obtaining the type of the element which is under the mouse pointer
Dim Element As String = HitInfo.HitTest.ToString()
' ...
End Sub
See Also