SftBox/OCX 4.5

SftBoxItems.AddFontNames Method

Softel vdm, Inc.

Adds a list of available fonts.

Syntax       

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

Delphi

Count := object.AddFontNames(InsertIndex : Integer; FontStyles : TOleEnum; AddPictures : WordBool; hDCPrinter : Integer)   : Integer;

object

A SftBoxItems 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.

Comments

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.


Feedback / comments / error reports for this topic
© 2008 - Softel vdm, Inc. - www.softelvdm.com