windowsforms-devexpress-dot-xtranavbar-dot-navbarhitinfo-6006a55b.md
Gets the link over which the test point resides.
Namespace : DevExpress.XtraNavBar
Assembly : DevExpress.XtraNavBar.v25.2.dll
NuGet Package : DevExpress.Win
public NavBarItemLink Link { get; }
Public ReadOnly Property Link As NavBarItemLink
| Type | Description |
|---|---|
| NavBarItemLink |
A NavBarItemLink object representing the link located under the test point. null ( Nothing in Visual Basic) if the test point is not over a link.
|
Use the NavBarControl.CalcHitInfo method to obtain information about a specified point’s location with respect to the control. If the specified point resides over a link (its caption or image), the method assigns the NavBarItemLink object representing this link to the Link property of the returned NavBarHitInfo object. If the specified point is not over a link, the Link property returns null ( Nothing in Visual Basic).
You can determine whether the test point is over a link via the NavBarHitInfo.InLink or NavBarHitInfo.HitTest properties.
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 link that is hovered over is accessed.
using DevExpress.XtraNavBar;
private void navBarControl1_MouseMove(object sender, MouseEventArgs e) {
NavBarHitInfo hitInfo = navBarControl1.CalcHitInfo(new Point(e.X, e.Y));
if (hitInfo.InLink) {
NavBarItemLink link = hitInfo.Link;
// perform operations on the link here
//...
}
}
Imports DevExpress.XtraNavBar
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))
If HitInfo.InLink Then
Dim Link As NavBarItemLink = HitInfo.Link
' perform operations on the link here
' ...
End If
End Sub
See Also