SftBox/OCX 4.5

SftBoxItems.AddFontStyles Method

Softel vdm, Inc.

Adds a list of available font styles.

Syntax       

VB.NET

Count = object.AddFontStyles(ByVal FontName As String, ByVal hDCPrinter As Integer, ByVal StylesText As String, ByVal ItalicText As String)  As Integer

VB

Count = object.AddFontStyles(ByVal FontName As String, ByVal hDCPrinter As Long, ByVal StylesText As String, ByVal ItalicText As String)  As Long

C#.NET

int Count = object.AddFontStyles(string FontName, int hDCPrinter, string StylesText, string ItalicText);

VC++

long Count = object->AddFontStyles(_bstr_t FontName, long hDCPrinter, _bstr_t StylesText, _bstr_t ItalicText);

C

HRESULT object->raw_AddFontStyles(BSTR FontName, long hDCPrinter, BSTR StylesText, BSTR ItalicText, long* Count);

Delphi

Count := object.AddFontStyles(FontName : WideString; hDCPrinter : Integer; StylesText : WideString; ItalicText : WideString)   : Integer;

object

A SftBoxItems object.

FontName

The name of the font whose available styles are to be added to the control.

hDCPrinter

Specify a valid printer device context handle if the font FontName is a printer font. Specify 0 for screen fonts.

StylesText

The font style text for each possible font style. Supply comma-delimited styles for each of the following font weights. The font weights are listed in ascending weight, lightest to darkest:

Font Weight

Description

FW_THIN

very light font

FW_EXTRALIGHT

 

FW_LIGHT

 

FW_NORMAL

normal font

FW_MEDIUM

 

FW_SEMIBOLD

 

FW_BOLD

bold font

FW_EXTRABOLD

 

FW_HEAVY

very heavy font

As fonts are enumerated by the control, the font weight returned by Windows is replaced by the substring supplied in StylesText for the corresponding weight. The font weights are documented in the Windows API reference, see the LOGFONT structure. If an empty string (0, null, NULL) is specified for this parameter, the default string "Normal,Normal,Normal,Normal,Bold,Bold,Bold,Bold,Bold" is used.

ItalicText

The string appended to the font style if a font has the italic attribute. If an empty string (0, null, NULL) is specified for this parameter, the default string ", Italic" is used.

Count

Returns the number of font styles added to the control.

Comments

The AddFontStyles method adds a list of available font styles.

The AddFontStyles method adds all available font styles of the font FontName to the combo box as items. The combo box is cleared first.

Font styles are added in ascending order, according to the font's weight.

The Cell.Data property of the cell in column 0 of each item will contain the font weight. The high order bit is set if the font style is italic.

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