Skip to main content
Bar

BarItem.OwnFont Property

OBSOLETE

Use the Appearance.Font property to specify the item's font.

Specifies the font used to display the captions of links corresponding to this item.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

[Browsable(false)]
[DXCategory("Appearance")]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use the Appearance.Font property to specify the item's font.")]
public virtual Font OwnFont { get; set; }

Property Value

Type Description
Font

A System.Drawing.Font object that specifies the font used to display the captions of associated links.

Remarks

The OwnFont property is synchronized with the Font attribute of the BarItem.Appearance property.

When you assign a font to the Appearance.Font property, the Appearance.Options.UseFont option is automatically enabled. So, the assigned font is immediately applied to the item’s links. You can turn off the Appearance.Options.UseFont option to temporarily disable the item’s font.

If no font is assigned to the Appearance.Font property or the item’s font is disabled, the default font is used (see the BarManagerAppearances.ItemsFont topic, to learn more).

Example

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 BarItem.Appearance property of the associated items. The AppearanceOptions.UseFont option is disabled to prevent bar items from being immediately painted using the assigned font.

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;
}

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.

LinkFont - OwnFont

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;
}
See Also