The following example shows how to paint hot-tracked bar items using a bold font.
This example contains two separate pieces of code. The first assigns a bold font to the links within the browser bar. This is performed by modifying the Appearance property of the associated items.
The AppearanceOptions.UseFont option is disabled to prevent bar items from being immediately painted using the assigned font.
C# |
using DevExpress.XtraBars;
barManager1.ForceInitialize();
Font itemFont = new Font(barManager1.GetController().AppearancesBar.ItemsFont, FontStyle.Bold);
foreach (BarItemLink link in barBrowser.ItemLinks) {
link.Item.Appearance.Font = itemFont;
link.Item.Appearance.Options.UseFont = false;
}
|
VB |
Imports DevExpress.XtraBars
BarManager1.ForceInitialize()
Dim ItemFont As New Font(barManager1.GetController().AppearancesBar.ItemsFont, FontStyle.Bold)
Dim Link As BarItemLink
For Each Link In BarBrowser.ItemLinks
Link.Item.Appearance.Font = ItemFont
Link.Item.Appearance.Options.UseFont = False
Next
|
The next code sample handles the BarManager.HighlightedLinkChanged event. It is used to enable the bold font for hot-tracked items.
The image below display the result of handling the BarManager.HighlightedLinkChanged event. The hot-tracked link is painted using the bold font.

C# |
private void barManager1_HighlightedLinkChanged(object sender,
DevExpress.XtraBars.HighlightedLinkChangedEventArgs e) {
if (e.PrevLink != null && e.PrevLink.Bar == barBrowser)
e.PrevLink.Item.Appearance.Options.UseFont = false;
if (e.Link != null && e.Link.Bar == barBrowser)
e.Link.Item.Appearance.Options.UseFont = true;
}
|
VB |
Private Sub BarManager1_HighlightedLinkChanged(ByVal sender As Object, _
ByVal e As DevExpress.XtraBars.HighlightedLinkChangedEventArgs) _
Handles BarManager1.HighlightedLinkChanged
If (Not e.PrevLink Is Nothing) Then
If (e.PrevLink.Bar Is BarBrowser) Then _
e.PrevLink.Item.Appearance.Options.UseFont = False
End If
If (Not e.Link Is Nothing) Then
If (e.Link.Bar Is BarBrowser) Then _
e.Link.Item.Appearance.Options.UseFont = True
End If
End Sub
|