FontCombo Control (VBCCRFontCombo)
The FontCombo control is a specialized combo box control for font selection, which automatically lists all fonts installed in the system and provides font preview functionality.
Properties
Basic Properties
Text
- Currently selected font nameList
- Font listListCount
- Number of list itemsListIndex
- Index of currently selected itemBackColor
- Background colorForeColor
- Foreground colorEnabled
- Whether control is enabledFont
- Font settingsVisible
- Whether visible
Specific Properties
FontType
- Type of fonts to displayALL_FONTS
(0) - All fontsTT_FONTS_ONLY
(1) - TrueType fonts onlyDEVICE_FONTS_ONLY
(2) - Device fonts onlyRASTER_FONTS_ONLY
(3) - Raster fonts only
PreviewText
- Preview textShowPreview
- Whether to show previewShowSymbols
- Whether to show symbol fontsMaxMRUCount
- Maximum number of recently used fonts
Events
Change
- Triggered when selection changesClick
- Triggered when control is clickedDblClick
- Triggered when control is double-clickedDropDown
- Triggered when list drops downGotFocus
- Triggered when control receives focusKeyDown
- Triggered when keyboard key is pressedKeyPress
- Triggered during keyboard key pressKeyUp
- Triggered when keyboard key is releasedLostFocus
- Triggered when control loses focusMouseDown
- Triggered when mouse button is pressedMouseMove
- Triggered when mouse movesMouseUp
- Triggered when mouse button is releasedScroll
- Triggered when list is scrolledCloseUp
- Triggered when dropdown list closes
Code Examples
Basic Usage
vb
Private Sub InitFontCombo()
With FontCombo1
.FontType = ALL_FONTS ' Show all fonts
.ShowPreview = True ' Show preview
.PreviewText = "AaBbYyZz" ' Set preview text
.ShowSymbols = False ' Don't show symbol fonts
End With
End Sub
Font Classifier
vb
Private Type FontInfo
Name As String
Type As Long
CharSet As Long
IsSymbol As Boolean
IsTrueType As Boolean
IsVertical As Boolean
End Type
Private Type FontManager
Fonts() As FontInfo
Count As Long
TTFonts() As String
TTCount As Long
SymbolFonts() As String
SymbolCount As Long
VerticalFonts() As String
VerticalCount As Long
End Type
Private Manager As FontManager
Private Sub InitFontManager()
With Manager
ReDim .Fonts(1 To 1000)
.Count = 0
ReDim .TTFonts(1 To 100)
.TTCount = 0
ReDim .SymbolFonts(1 To 50)
.SymbolCount = 0
ReDim .VerticalFonts(1 To 50)