Back to Devexpress

Stub Glyphs

windowsforms-117207-controls-and-libraries-ribbon-bars-and-menu-common-features-stub-glyphs.md

latest7.5 KB
Original Source

Stub Glyphs

  • Jan 16, 2025
  • 3 minutes to read

Bar items and their links display images and string captions. Images are assigned by using the following properties.

When none of these properties are specified, links to bar items will, by default, display stub glyphs instead. A stub glyph is a colored square with rounded corners and one or two of the initial letters of the item caption. These fake icons are primarily used to quickly identify icons that have no icons as yet so you won’t miss them. The figure below illustrates a sample.

Enable Stub Glyphs

You can enable stub glyphs for all item links within a Ribbon (toolbars), or for individual links only. To enable stub glyphs for all items at once, access the BarManager.OptionsStubGlyphs or RibbonControl.OptionsStubGlyphs properties section and set the StubGlyphOptions.AllowStubGlyphs property to DefaultBoolean.True or DefaultBoolean.Default.

Individual items provide the BarItem.AllowStubGlyph properties that, when not set to DefaultBoolean.Default, override the global setting. For example, the following figure illustrates the “Cut” bar item link that displays a stub glyph while other links don’t.

csharp
ribbonControl1.OptionsStubGlyphs.AllowStubGlyphs = DefaultBoolean.False;
iCut.AllowStubGlyph = DefaultBoolean.True;
vb
ribbonControl1.OptionsStubGlyphs.AllowStubGlyphs = DefaultBoolean.False
iCut.AllowStubGlyph = DefaultBoolean.True

Customize Stub Glyphs

The BarManager.OptionsStubGlyphs and RibbonControl.OptionsStubGlyphs sections provide multiple properties to customize the appearance of item stub glyphs.

|

Property

|

Description

| | --- | --- | |

StubGlyphOptions.CaseMode

|

Allows you to choose the case mode for captions within stub glyphs. Accepts the following values of the GlyphTextCaseMode enumerator.

  • UpperCase - all glyph caption characters are in the upper case.
  • LowerCase - all glyph caption characters are in the lower case.
  • SentenceCase or Default - the first glyph caption character is in the upper case, the second one is in the lower case.

| |

StubGlyphOptions.ColorMode

|

By default, each stub glyph is painted using a random color from six available colors. You can utilize this property to explicitly choose one specific color for all stub glyphs.

| |

StubGlyphOptions.CornerRadius

|

Specifies the corner radius for rectangular stub glyphs (see the “Type” property). Set this property to 0 for straight square icons.

| |

StubGlyphOptions.Font

|

Specifies the font settings for stub glyphs’ caption strings. The following figure illustrates glyph captions painted using the bold “Segoe Condensed” font.

| |

StubGlyphOptions.HorizontalAlignment

StubGlyphOptions.VerticalAlignment

|

Two properties that allow you to arrange stub glyph captions into one of nine predefined positions.

| |

StubGlyphOptions.LetterCount

|

Stub glyph captions always start with the first character of their related bar item captions. Set this property to GlyphTextSymbolCount.Two to draw the second character as well. Displaying two characters requires more space and thus, is primarily recommended for large bar item links.

| |

StubGlyphOptions.Padding

|

Gets or sets the distance between glyph borders and inner text content.

| |

StubGlyphOptions.RandomizeColors

|

Gets or sets whether different variations of the same hue are enabled.

| |

StubGlyphOptions.Type

|

Switches between rectangular and circular stub glyphs. For rectangular glyphs, you can additionally specify the StubGlyphOptions.CornerRadius property.

|