Help Center

CAxHost.OleCreateFontmethod

Creates a standard IFont object.

COMmethodCaxHost.incdocumented

Syntax

FUNCTION OleCreateFont (BYREF wszFaceName AS WSTRING, BYVAL cySize AS LONG, BYVAL fWeight AS LONG = FW_NORMAL, BYVAL fItalic AS UBYTE = FALSE, BYVAL fUnderline AS UBYTE = FALSE, BYVAL fStrikeOut AS UBYTE = FALSE, BYVAL fCharSet AS UBYTE = DEFAULT_CHARSET) AS IFont PTR

Parameters

NameDescription
wszFaceNameA string that specifies the typeface name of the font. The length of this string must not exceed 31 characters. The EnumFontFamilies function can be used to enumerate the typeface names of all currently available fonts. If wszFaceName is an empty string, GDI uses the first font that matches the other specified attributes.
cySizeSpecifies the height, in logical units, of the font's character cell or character.
fWeightInitial weight of the font. If the weight is below 550 (the average of FW_NORMAL, 400, and FW_BOLD, 700), then the Bold property is also initialized to FALSE. If the weight is above 550, the Bold property is set to TRUE.
The following values are defined for convenience: FW_DONTCARE (0), FW_THIN (100), FW_EXTRALIGHT (200), FW_ULTRALIGHT (200), FW_LIGHT (300), FW_NORMAL (400), FW_REGULAR (400), FW_MEDIUM (500), FW_SEMIBOLD (600), FW_DEMIBOLD (600), FW_BOLD (700), FW_EXTRABOLD (800), FW_ULTRABOLD (800), FW_HEAVY (900), FW_BLACK (900)
fItalicSpecifies an italic font if set to TRUE.
fUnderlineSpecifies an underlined font if set to TRUE.
fStrikeOutSpecifies a strikeout font if set to TRUE.
fCharSetSpecifies the character set. The following values are predefined:
ANSI_CHARSET, BALTIC_CHARSET, CHINESEBIG5_CHARSET, DEFAULT_CHARSET, EASTEUROPE_CHARSET, GB2312_CHARSET, GREEK_CHARSET, HANGUL_CHARSET, MAC_CHARSET, OEM_CHARSET, RUSSIAN_CHARSET, SHIFTJIS_CHARSET, SYMBOL_CHARSET, TURKISH_CHARSET.
Korean Windows: JOHAB_CHARSET
Middle-Eastern Windows: HEBREW_CHARSET, ARABIC_CHARSET.
Thai Windows: THAI_CHARSET.

Return value

A pointer to the object indicates success. NULL indicates failure.

Description

Creates a standard IFont object.

Example

DIM pFont AS IFont = CAxHost.CreateFont("MS Sans Serif", 8, FW_NORMAL, , , , DEFAULT_CHARSET) DIM pFont AS IFont = CAxHost.CreateFont("Courier New", 10, FW_BOLD, , , , DEFAULT_CHARSET) DIM pFont AS IFont = CAxHost.CreateFont("Marlett", 8, FW_NORMAL, , , , SYMBOL_CHARSET)

Reference

  • Include file CaxHost.inc
  • Defined in AfxNova/CAxHost.inc:614
  • Documented in COM/CAxHost Class.md
  • Topic: CAxHost Class