SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Adds a list of available fonts.
VB.NET | Count = object.AddFontNames(ByVal InsertIndex As Integer, ByVal FontStyles As SftBoxFontConstants, ByVal AddPictures As Boolean, ByVal hDCPrinter As Integer) As Integer |
VB | Count = object.AddFontNames(ByVal InsertIndex As Long, ByVal FontStyles As SftBoxFontConstants, ByVal AddPictures As Boolean, ByVal hDCPrinter As Long) As Long |
C#.NET | int Count = object.AddFontNames(int InsertIndex, SftBoxFontConstants FontStyles, bool AddPictures, int hDCPrinter); |
VC++ | long Count = object->AddFontNames(long InsertIndex, enum SftBoxFontConstants FontStyles, VARIANT_BOOL AddPictures, long hDCPrinter); |
C | HRESULT object->raw_AddFontNames(long InsertIndex, enum SftBoxFontConstants FontStyles, VARIANT_BOOL AddPictures, long hDCPrinter, long* Count); |
object
InsertIndex
The zero-based index of the position where the new item(s) will be inserted. Specify -1 to add the list of font names at the end of the list.
FontStyles
Defines the desired font styles to be added to the list. Specify one or a combination of the following:
FontStyles | Value | Description |
---|---|---|
fontSftBoxFixed | 1 | Add fixed fonts. |
fontSftBoxVariable | 2 | Add variable fonts. |
fontSftBoxTrueType | 4 | Add TrueType fonts. |
fontSftBoxRaster | 8 | Add raster fonts. |
fontSftBoxVector | 16 | Add vector fonts. |
fontSftBoxScreen | 32 | Add screen (display) fonts. If this option is given, display fonts will be added even if hDCPrinter describes a printer font. |
fontSftBoxAll | 32767 | All fonts (all of the above). |
AddPictures
Defines whether item pictures are automatically added for raster and TrueType fonts.
Boolean | Description |
---|---|
True | Item pictures are automatically added for raster and TrueType fonts. The AddFontNames method clears all item pictures in the control before adding the new list of font names. |
False | Item pictures are not added. |
hDCPrinter
Specify a valid printer device context handle to list fonts for a printer. Specify 0 to list display fonts (screen fonts only). If a valid printer device context handle is provided, screen fonts are only added if FontStyles includes fontSftBoxScreen.
Count
Returns the number of font names added to the control.
The AddFontNames method adds a list of available fonts.
The AddFontNames method adds all font names of all available fonts which match the criteria defined using FontStyles as items to the combo box.
Either fontSftBoxFixed or fontSftBoxVariable (or both) must be specified, otherwise no fonts will match the criteria.
The AddFontNames method can be called many times for a single combo box. This way it is possible to show various categories of fonts in the same combo box by using the FontStyles parameter. Item pictures must be set by the application based on the Cell.Data property, as each invocation of AddFontNames clears all existing item pictures.
The Cell.Data property of the cell in column 0 of each item will contain the font type DEVICE_FONTTYPE, RASTER_FONTTYPE or TRUETYPE_FONTTYPE as returned by EnumFontFamProc (see the Windows API documentation).
The drop down portion is automatically hidden when the combo box contents are changed using this method. The DropDown.SuppressOn method can be used to suppress hiding the drop down portion when adding/inserting items.
' add all font information UpdateFontNames() End Sub Private Sub UpdateFontNames() ' add all font names fontNames.BulkUpdate = True fontNames.Items.Clear() fontNames.Items.AddFontNames(-1, SftBoxFontConstants.fontSftBoxAll, True, 0) fontNames.Items.Selection = 0 PerformSort(fontNames, SftBoxSortConstants.sortSftBoxAscending) fontNames.BulkUpdate = False fontNames.Columns.MakeOptimal(0) fontNames.Items.RecalcHorizontalExtent(0) End Sub
SftBoxCtrl.Items.Sort -1, 0, sortSftBoxDescending End If End Sub Private Sub UpdateFontNames() ' add all font names FontNames.BulkUpdate = True FontNames.Items.Clear FontNames.Items.AddFontNames -1, fontSftBoxAll, True, 0 FontNames.Items.Selection = 0 PerformSort FontNames FontNames.BulkUpdate = False FontNames.Columns.MakeOptimal 0 FontNames.Items.RecalcHorizontalExtent 0 End Sub
UpdateFontNames(); } private void UpdateFontNames() { // add all font names fontNames.BulkUpdate = true; fontNames.Items.Clear(); fontNames.Items.AddFontNames(-1, SftBoxFontConstants.fontSftBoxAll, true, 0); fontNames.Items.Selection = 0; PerformSort(fontNames, SftBoxSortConstants.sortSftBoxAscending); fontNames.BulkUpdate = false; fontNames.Columns.MakeOptimal(0); fontNames.Items.RecalcHorizontalExtent(0); }
void CFontDlgDlg::UpdateFontNames() { // add all font names ISftBoxPtr vFontNames = m_FontNames.GetControlUnknown(); vFontNames->BulkUpdate = VARIANT_TRUE; vFontNames->Items->Clear(); vFontNames->Items->AddFontNames(-1, fontSftBoxAll, VARIANT_TRUE, 0); vFontNames->Items->Selection = 0; PerformSort(vFontNames, sortSftBoxAscending); vFontNames->BulkUpdate = VARIANT_FALSE; vFontNames->Columns->MakeOptimal(0); vFontNames->Items->RecalcHorizontalExtent(0); m_CondHeaders.SetCheck(1); }
See Also SftBoxItems Object | Object Hierarchy